directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r240387 - in /directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw: ./ exceptions/ io/ messages/ protocol/ service/ value/
Date Sat, 27 Aug 2005 03:53:02 GMT
Author: erodriguez
Date: Fri Aug 26 20:52:51 2005
New Revision: 240387

URL: http://svn.apache.org/viewcvs?rev=240387&view=rev
Log:
Formatting:  whitespace, line breaks, or other code convention

Modified:
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/ChangePasswordErrorService.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/ChangePasswordService.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/exceptions/ChangePasswordException.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/exceptions/ErrorType.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/io/ChangePasswordDataDecoder.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/io/ChangePasswordErrorEncoder.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/io/ChangePasswordReplyEncoder.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/io/ChangePasswordRequestDecoder.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/AbstractPasswordMessage.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/AbstractPasswordMessageModifier.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordError.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordErrorModifier.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordReply.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordReplyModifier.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordRequest.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordRequestModifier.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/protocol/ChangePasswordDecoder.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/protocol/ChangePasswordEncoder.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/protocol/ChangePasswordProtocolHandler.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/protocol/ChangePasswordProtocolProvider.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ChangePasswordServiceImpl.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/value/ChangePasswordData.java
    directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/value/ChangePasswordDataModifier.java

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/ChangePasswordErrorService.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/ChangePasswordErrorService.java?rev=240387&r1=240386&r2=240387&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/ChangePasswordErrorService.java (original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/ChangePasswordErrorService.java Fri Aug 26 20:52:51 2005
@@ -24,40 +24,41 @@
 import org.apache.kerberos.messages.ErrorMessageModifier;
 import org.apache.kerberos.messages.value.KerberosTime;
 
-public class ChangePasswordErrorService {
+public class ChangePasswordErrorService
+{
+    private KdcConfiguration config;
 
-	private KdcConfiguration _config;
-	
-	public ChangePasswordErrorService(KdcConfiguration config) {
-		_config = config;
-	}
-	
-	public ChangePasswordError getReplyFor(KerberosException exception) {
-		
-		ErrorMessage errorMessage = getErrorMessage(exception);
-		
-		ChangePasswordErrorModifier modifier = new ChangePasswordErrorModifier();
-		modifier.setErrorMessage(errorMessage);
-		
-		return modifier.getChangePasswordError();
-	}
-	
-	// TODO - near duplicate with main KDC error service; refactor
-	public ErrorMessage getErrorMessage(KerberosException exception) {
-		ErrorMessageModifier modifier = new ErrorMessageModifier();
-		
-		KerberosTime now = new KerberosTime();
-		
-		modifier.setErrorCode(exception.getErrorCode());
-		modifier.setExplanatoryText(exception.getMessage());
-		
-		// this is the only difference with main KDC error service; refactor
-		modifier.setServerPrincipal(_config.getChangepwPrincipal());
-		
-		modifier.setServerTime(now);
-		modifier.setServerMicroSecond(0);
-		
-		return modifier.getErrorMessage();
-	}
-}
+    public ChangePasswordErrorService( KdcConfiguration config )
+    {
+        this.config = config;
+    }
+
+    public ChangePasswordError getReplyFor( KerberosException exception )
+    {
+        ErrorMessage errorMessage = getErrorMessage( exception );
+
+        ChangePasswordErrorModifier modifier = new ChangePasswordErrorModifier();
+        modifier.setErrorMessage( errorMessage );
+
+        return modifier.getChangePasswordError();
+    }
+
+    // TODO - near duplicate with main KDC error service; refactor
+    public ErrorMessage getErrorMessage( KerberosException exception )
+    {
+        ErrorMessageModifier modifier = new ErrorMessageModifier();
 
+        KerberosTime now = new KerberosTime();
+
+        modifier.setErrorCode( exception.getErrorCode() );
+        modifier.setExplanatoryText( exception.getMessage() );
+
+        // this is the only difference with main KDC error service; refactor
+        modifier.setServerPrincipal( config.getChangepwPrincipal() );
+
+        modifier.setServerTime( now );
+        modifier.setServerMicroSecond( 0 );
+
+        return modifier.getErrorMessage();
+    }
+}

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/ChangePasswordService.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/ChangePasswordService.java?rev=240387&r1=240386&r2=240387&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/ChangePasswordService.java (original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/ChangePasswordService.java Fri Aug 26 20:52:51 2005
@@ -29,7 +29,6 @@
  */
 public interface ChangePasswordService
 {
-	public ChangePasswordReply getReplyFor( ChangePasswordRequest request )
-			throws ChangePasswordException, KerberosException, IOException;
+    public ChangePasswordReply getReplyFor( ChangePasswordRequest request )
+            throws ChangePasswordException, KerberosException, IOException;
 }
-

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/exceptions/ChangePasswordException.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/exceptions/ChangePasswordException.java?rev=240387&r1=240386&r2=240387&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/exceptions/ChangePasswordException.java (original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/exceptions/ChangePasswordException.java Fri Aug 26 20:52:51 2005
@@ -29,18 +29,17 @@
      * The Change Password error code associated with this exception
      */
     private final int errorCode;
-    
+
     /**
      * Additional data about the error for use by the application
      * to help it recover from or handle the error.
      */
-    private byte[] explanatoryData; 
-    
+    private byte[] explanatoryData;
+
     // ------------------------------------------------------------------------
     // C O N S T R U C T O R S
     // ------------------------------------------------------------------------
 
-
     /**
      * Creates a ChangePasswordException with an error code and a message.
      *
@@ -54,7 +53,6 @@
         this.errorCode = errorCode;
     }
 
-
     /**
      * Creates a ChangePasswordException with an error code, a message and an
      * underlying throwable that caused this fault.
@@ -69,13 +67,11 @@
 
         this.errorCode = errorCode;
     }
-    
-    
+
     /**
      * Creates a ChangePasswordException with an error code and a message.
      *
-     * @param errorCode the error code associated with this ChangePasswordException
-     * @param msg the standard Change Password error message for this ChangePasswordException
+     * @param errorType the error type associated with this ChangePasswordException
      */
     public ChangePasswordException( ErrorType errorType )
     {
@@ -83,14 +79,12 @@
 
         this.errorCode = errorType.getOrdinal();
     }
-    
-    
+
     /**
      * Creates a ChangePasswordException with an error code, a message, and
      * data helping to explain what caused this fault.
      *
-     * @param errorCode the error code associated with this ChangePasswordException
-     * @param msg the standard Change Password error message for this ChangePasswordException
+     * @param errorType the error type associated with this ChangePasswordException
      * @param explanatoryData data helping to explain this fault, if any
      */
     public ChangePasswordException( ErrorType errorType, byte[] explanatoryData )
@@ -100,8 +94,7 @@
         this.errorCode = errorType.getOrdinal();
         this.explanatoryData = explanatoryData;
     }
-    
-    
+
     /**
      * Gets the protocol error code associated with this ChangePasswordException.
      *
@@ -111,15 +104,14 @@
     {
         return this.errorCode;
     }
-    
+
     /**
      * Gets the explanatory data associated with this ChangePasswordException.
      *
      * @return the explanatory data associated with this ChangePasswordException
      */
-	public byte[] getExplanatoryData()
-	{
-		return explanatoryData;
-	}
+    public byte[] getExplanatoryData()
+    {
+        return explanatoryData;
+    }
 }
-

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/exceptions/ErrorType.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/exceptions/ErrorType.java?rev=240387&r1=240386&r2=240387&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/exceptions/ErrorType.java (original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/exceptions/ErrorType.java Fri Aug 26 20:52:51 2005
@@ -29,38 +29,31 @@
  */
 public final class ErrorType implements Comparable
 {
-	/*
-	 * Enumeration elements are constructed once upon class loading.
-	 * Order of appearance here determines the order of compareTo.
-	 */
-	public static final ErrorType KRB5_KPASSWD_MALFORMED = new ErrorType( 1,
-	    "Request failed due to being malformed." );
-	public static final ErrorType KRB5_KPASSWD_HARDERROR = new ErrorType( 2,
-	    "Request failed due to a hard error in processing the request." );
-	public static final ErrorType KRB5_KPASSWD_AUTHERROR = new ErrorType( 3,
-	    "Request failed due to an error in authentication processing." );
-	public static final ErrorType KRB5_KPASSWD_SOFTERROR = new ErrorType( 4,
-	    "Request failed due to a soft error in processing the request." );
-	public static final ErrorType KRB5_KPASSWD_ACCESSDENIED = new ErrorType( 5,
-	    "Requestor not authorized." );
-	public static final ErrorType KRB5_KPASSWD_BAD_VERSION = new ErrorType( 6,
-	    "Protocol version unsupported." );
-	public static final ErrorType KRB5_KPASSWD_INITIAL_FLAG_NEEDED = new ErrorType( 7,
-	    "Initial flag required." );
-	public static final ErrorType KRB5_KPASSWD_UNKNOWN_ERROR = new ErrorType( 8,
-	    "Request failed for an unknown reason." );
+    /*
+     * Enumeration elements are constructed once upon class loading.
+     * Order of appearance here determines the order of compareTo.
+     */
+    public static final ErrorType KRB5_KPASSWD_MALFORMED = new ErrorType( 1,
+            "Request failed due to being malformed." );
+    public static final ErrorType KRB5_KPASSWD_HARDERROR = new ErrorType( 2,
+            "Request failed due to a hard error in processing the request." );
+    public static final ErrorType KRB5_KPASSWD_AUTHERROR = new ErrorType( 3,
+            "Request failed due to an error in authentication processing." );
+    public static final ErrorType KRB5_KPASSWD_SOFTERROR = new ErrorType( 4,
+            "Request failed due to a soft error in processing the request." );
+    public static final ErrorType KRB5_KPASSWD_ACCESSDENIED = new ErrorType( 5,
+            "Requestor not authorized." );
+    public static final ErrorType KRB5_KPASSWD_BAD_VERSION = new ErrorType( 6,
+            "Protocol version unsupported." );
+    public static final ErrorType KRB5_KPASSWD_INITIAL_FLAG_NEEDED = new ErrorType( 7,
+            "Initial flag required." );
+    public static final ErrorType KRB5_KPASSWD_UNKNOWN_ERROR = new ErrorType( 8,
+            "Request failed for an unknown reason." );
 
     /** Array for building a List of VALUES. */
-    private static final ErrorType[] values = {
-            KRB5_KPASSWD_MALFORMED,
-            KRB5_KPASSWD_HARDERROR,
-            KRB5_KPASSWD_AUTHERROR,
-            KRB5_KPASSWD_SOFTERROR,
-            KRB5_KPASSWD_ACCESSDENIED,
-            KRB5_KPASSWD_BAD_VERSION,
-            KRB5_KPASSWD_INITIAL_FLAG_NEEDED,
-            KRB5_KPASSWD_UNKNOWN_ERROR
-    };
+    private static final ErrorType[] values = { KRB5_KPASSWD_MALFORMED, KRB5_KPASSWD_HARDERROR,
+            KRB5_KPASSWD_AUTHERROR, KRB5_KPASSWD_SOFTERROR, KRB5_KPASSWD_ACCESSDENIED,
+            KRB5_KPASSWD_BAD_VERSION, KRB5_KPASSWD_INITIAL_FLAG_NEEDED, KRB5_KPASSWD_UNKNOWN_ERROR };
 
     /** a list of all the error type constants */
     public static final List VALUES = Collections.unmodifiableList( Arrays.asList( values ) );
@@ -71,17 +64,15 @@
     /** the value/code for the error type */
     private final int ordinal;
 
-
     /**
      * Private constructor prevents construction outside of this class.
      */
     private ErrorType( int ordinal, String name )
     {
         this.ordinal = ordinal;
-        this.name    = name;
+        this.name = name;
     }
 
-
     /**
      * Returns the message for this Change Password error.
      *
@@ -89,9 +80,9 @@
      */
     public String getMessage()
     {
-		return name;
-	}
-    
+        return name;
+    }
+
     /**
      * Returns the message for this Change Password error.
      *
@@ -99,9 +90,9 @@
      */
     public String toString()
     {
-		return name;
-	}
-    
+        return name;
+    }
+
     /**
      * Compares this type to another object hopefully one that is of the same
      * type.
@@ -109,38 +100,37 @@
      * @param that the object to compare this ErrorType to
      * @return ordinal - ( ( ErrorType ) that ).ordinal;
      */
-	public int compareTo( Object that )
+    public int compareTo( Object that )
     {
-		return ordinal - ( ( ErrorType ) that ).ordinal;
-	}
-	
+        return this.ordinal - ( (ErrorType) that ).ordinal;
+    }
+
     /**
      * Gets the ordinal by its ordinal value.
      *
      * @param ordinal the ordinal value of the ordinal
      * @return the type corresponding to the ordinal value
      */
-	public static ErrorType getTypeByOrdinal( int ordinal )
+    public static ErrorType getTypeByOrdinal( int ordinal )
     {
-		for ( int ii = 0; ii < values.length; ii++ )
+        for ( int ii = 0; ii < values.length; ii++ )
         {
-			if ( values[ ii ].ordinal == ordinal )
+            if ( values[ ii ].ordinal == ordinal )
             {
-				return values[ ii ];
+                return values[ ii ];
             }
         }
 
-		return KRB5_KPASSWD_UNKNOWN_ERROR;
-	}
-	
+        return KRB5_KPASSWD_UNKNOWN_ERROR;
+    }
+
     /**
      * Gets the ordinal value associated with this Change Password error.
      *
      * @return the ordinal value associated with this Change Password error
      */
-	public int getOrdinal()
+    public int getOrdinal()
     {
-		return ordinal;
-	}
+        return ordinal;
+    }
 }
-

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/io/ChangePasswordDataDecoder.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/io/ChangePasswordDataDecoder.java?rev=240387&r1=240386&r2=240387&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/io/ChangePasswordDataDecoder.java (original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/io/ChangePasswordDataDecoder.java Fri Aug 26 20:52:51 2005
@@ -30,48 +30,46 @@
 import org.apache.changepw.value.ChangePasswordDataModifier;
 import org.apache.kerberos.io.decoder.PrincipalNameDecoder;
 
-
 public class ChangePasswordDataDecoder
 {
-	public ChangePasswordData decodeChangePasswordData( byte[] encodedChangePasswdData )
-		throws IOException
-	{
-		ASN1InputStream ais = new ASN1InputStream( encodedChangePasswdData );
-		
-		DERSequence sequence = (DERSequence) ais.readObject();
-		
-		return decodeChangePasswdData( sequence );
-	}
-	
-	protected ChangePasswordData decodeChangePasswdData( DERSequence sequence )
-	{
-		ChangePasswordDataModifier modifier = new ChangePasswordDataModifier();
+    public ChangePasswordData decodeChangePasswordData( byte[] encodedChangePasswdData )
+            throws IOException
+    {
+        ASN1InputStream ais = new ASN1InputStream( encodedChangePasswdData );
 
-		for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
-		{
-			DERTaggedObject object = ( (DERTaggedObject) e.nextElement() );
-			int tag = object.getTagNo();
-			DEREncodable derObject = object.getObject();
-			switch ( tag )
-			{
-				case 0:
-					DEROctetString tag0 = (DEROctetString) derObject;
-					modifier.setNewPassword( tag0.getOctets() );
-					break;
-				case 1:
-					DERSequence tag1 = (DERSequence) derObject;
-					modifier.setTargetName( PrincipalNameDecoder.decode( tag1 ) );
-					break;
-				case 2:
-					DERGeneralString tag2 = (DERGeneralString) derObject;
-					modifier.setTargetRealm( tag2.getString() );
-					break;
-				default:
-					break;
-			}
-		}
-		
-		return modifier.getChangePasswdData();
-	}
-}
+        DERSequence sequence = (DERSequence) ais.readObject();
+
+        return decodeChangePasswdData( sequence );
+    }
 
+    protected ChangePasswordData decodeChangePasswdData( DERSequence sequence )
+    {
+        ChangePasswordDataModifier modifier = new ChangePasswordDataModifier();
+
+        for ( Enumeration e = sequence.getObjects(); e.hasMoreElements(); )
+        {
+            DERTaggedObject object = ( (DERTaggedObject) e.nextElement() );
+            int tag = object.getTagNo();
+            DEREncodable derObject = object.getObject();
+            switch ( tag )
+            {
+                case 0:
+                    DEROctetString tag0 = (DEROctetString) derObject;
+                    modifier.setNewPassword( tag0.getOctets() );
+                    break;
+                case 1:
+                    DERSequence tag1 = (DERSequence) derObject;
+                    modifier.setTargetName( PrincipalNameDecoder.decode( tag1 ) );
+                    break;
+                case 2:
+                    DERGeneralString tag2 = (DERGeneralString) derObject;
+                    modifier.setTargetRealm( tag2.getString() );
+                    break;
+                default:
+                    break;
+            }
+        }
+
+        return modifier.getChangePasswdData();
+    }
+}

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/io/ChangePasswordErrorEncoder.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/io/ChangePasswordErrorEncoder.java?rev=240387&r1=240386&r2=240387&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/io/ChangePasswordErrorEncoder.java (original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/io/ChangePasswordErrorEncoder.java Fri Aug 26 20:52:51 2005
@@ -26,25 +26,24 @@
 
 public class ChangePasswordErrorEncoder
 {
-	public void encode( ByteBuffer buf, ChangePasswordError message ) throws IOException
-	{
-		// Build error message bytes
-		ErrorMessage errorMessage = message.getErrorMessage();
-		ErrorMessageEncoder errorEncoder = new ErrorMessageEncoder();
-		byte[] errorBytes = errorEncoder.encode( errorMessage );
-		
-		short headerLength = 6;
-		
-		short messageLength = (short)( headerLength + errorBytes.length );
-		buf.putShort( messageLength );
-		
-		short protocolVersion = 1;
-		buf.putShort( protocolVersion );
-		
-		short zeroIndicatesError = 0;
-		buf.putShort( zeroIndicatesError );
-		
-		buf.put( errorBytes );
-	}
-}
+    public void encode( ByteBuffer buf, ChangePasswordError message ) throws IOException
+    {
+        // Build error message bytes
+        ErrorMessage errorMessage = message.getErrorMessage();
+        ErrorMessageEncoder errorEncoder = new ErrorMessageEncoder();
+        byte[] errorBytes = errorEncoder.encode( errorMessage );
+
+        short headerLength = 6;
+
+        short messageLength = (short) ( headerLength + errorBytes.length );
+        buf.putShort( messageLength );
 
+        short protocolVersion = 1;
+        buf.putShort( protocolVersion );
+
+        short zeroIndicatesError = 0;
+        buf.putShort( zeroIndicatesError );
+
+        buf.put( errorBytes );
+    }
+}

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/io/ChangePasswordReplyEncoder.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/io/ChangePasswordReplyEncoder.java?rev=240387&r1=240386&r2=240387&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/io/ChangePasswordReplyEncoder.java (original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/io/ChangePasswordReplyEncoder.java Fri Aug 26 20:52:51 2005
@@ -26,33 +26,31 @@
 import org.apache.kerberos.messages.application.ApplicationReply;
 import org.apache.kerberos.messages.application.PrivateMessage;
 
-
 public class ChangePasswordReplyEncoder
 {
-	public void encode( ByteBuffer buf, ChangePasswordReply message ) throws IOException
-	{
-		// Build application reply bytes
-		ApplicationReply appReply = message.getApplicationReply();
-		ApplicationReplyEncoder appEncoder = new ApplicationReplyEncoder();
-		byte[] encodedAppReply = appEncoder.encode( appReply );
-
-		// Build private message bytes
-		PrivateMessage privateMessage = message.getPrivateMessage();
-		PrivateMessageEncoder privateEncoder = new PrivateMessageEncoder();
-		byte[] privateBytes = privateEncoder.encode( privateMessage );
-		
-		short headerLength = 6;
-		
-		short messageLength = (short)( headerLength + encodedAppReply.length + privateBytes.length );
-		
-		short protocolVersion = 1;
-		
-		buf.putShort( messageLength );
-		buf.putShort( protocolVersion );
-		buf.putShort( (short)encodedAppReply.length );
-		
-		buf.put( encodedAppReply );
-		buf.put( privateBytes );
-	}
-}
+    public void encode( ByteBuffer buf, ChangePasswordReply message ) throws IOException
+    {
+        // Build application reply bytes
+        ApplicationReply appReply = message.getApplicationReply();
+        ApplicationReplyEncoder appEncoder = new ApplicationReplyEncoder();
+        byte[] encodedAppReply = appEncoder.encode( appReply );
+
+        // Build private message bytes
+        PrivateMessage privateMessage = message.getPrivateMessage();
+        PrivateMessageEncoder privateEncoder = new PrivateMessageEncoder();
+        byte[] privateBytes = privateEncoder.encode( privateMessage );
+
+        short headerLength = 6;
 
+        short messageLength = (short) ( headerLength + encodedAppReply.length + privateBytes.length );
+
+        short protocolVersion = 1;
+
+        buf.putShort( messageLength );
+        buf.putShort( protocolVersion );
+        buf.putShort( (short) encodedAppReply.length );
+
+        buf.put( encodedAppReply );
+        buf.put( privateBytes );
+    }
+}

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/io/ChangePasswordRequestDecoder.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/io/ChangePasswordRequestDecoder.java?rev=240387&r1=240386&r2=240387&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/io/ChangePasswordRequestDecoder.java (original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/io/ChangePasswordRequestDecoder.java Fri Aug 26 20:52:51 2005
@@ -28,33 +28,32 @@
 
 public class ChangePasswordRequestDecoder
 {
-	public ChangePasswordRequest decode( ByteBuffer buf ) throws IOException
-	{
-		ChangePasswordRequestModifier modifier = new ChangePasswordRequestModifier();
-		
-		modifier.setMessageLength( buf.getShort() );
-		modifier.setProtocolVersionNumber( buf.getShort() );
-		
-		short authHeaderLength = buf.getShort();
-		modifier.setAuthHeaderLength( authHeaderLength );
-		
-		byte[] undecodedAuthHeader = new byte[ authHeaderLength ];
-		buf.get( undecodedAuthHeader, 0, authHeaderLength );
-		
-		ApplicationRequestDecoder decoder = new ApplicationRequestDecoder();
-		ApplicationRequest authHeader = decoder.decode( undecodedAuthHeader );
-		
-		modifier.setAuthHeader( authHeader );
-		
-		byte[] encodedPrivate = new byte[ buf.remaining() ];
-		buf.get( encodedPrivate, 0, buf.remaining() );
-		
-		PrivateMessageDecoder privateDecoder = new PrivateMessageDecoder();
-		PrivateMessage privMessage = privateDecoder.decode( encodedPrivate );
-		
-		modifier.setPrivateMessage( privMessage );
-		
-		return modifier.getChangePasswordMessage();
-	}
-}
+    public ChangePasswordRequest decode( ByteBuffer buf ) throws IOException
+    {
+        ChangePasswordRequestModifier modifier = new ChangePasswordRequestModifier();
+
+        modifier.setMessageLength( buf.getShort() );
+        modifier.setProtocolVersionNumber( buf.getShort() );
+
+        short authHeaderLength = buf.getShort();
+        modifier.setAuthHeaderLength( authHeaderLength );
+
+        byte[] undecodedAuthHeader = new byte[ authHeaderLength ];
+        buf.get( undecodedAuthHeader, 0, authHeaderLength );
+
+        ApplicationRequestDecoder decoder = new ApplicationRequestDecoder();
+        ApplicationRequest authHeader = decoder.decode( undecodedAuthHeader );
 
+        modifier.setAuthHeader( authHeader );
+
+        byte[] encodedPrivate = new byte[ buf.remaining() ];
+        buf.get( encodedPrivate, 0, buf.remaining() );
+
+        PrivateMessageDecoder privateDecoder = new PrivateMessageDecoder();
+        PrivateMessage privMessage = privateDecoder.decode( encodedPrivate );
+
+        modifier.setPrivateMessage( privMessage );
+
+        return modifier.getChangePasswordMessage();
+    }
+}

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/AbstractPasswordMessage.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/AbstractPasswordMessage.java?rev=240387&r1=240386&r2=240387&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/AbstractPasswordMessage.java (original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/AbstractPasswordMessage.java Fri Aug 26 20:52:51 2005
@@ -16,31 +16,35 @@
  */
 package org.apache.changepw.messages;
 
-abstract public class AbstractPasswordMessage {
-	
+abstract public class AbstractPasswordMessage
+{
     // ChangePassword protocol version number
-	public static final int PVNO = 1;
-	
-	private short _messageLength;
-	private short _protocolVersionNumber;
-	private short _authHeaderLength;
-	
-	protected AbstractPasswordMessage(short messageLength, short versionNumber,
-			short authHeaderLength) {
-		
-		_messageLength         = messageLength;
-		_protocolVersionNumber = versionNumber;
-		_authHeaderLength      = authHeaderLength;
-	}
-	
-	public short getMessageLength() {
-		return _messageLength;
-	}
-	public short getProtocolVersionNumber() {
-		return _protocolVersionNumber;
-	}
-	public short getAuthHeaderLength() {
-		return _authHeaderLength;
-	}
-}
+    public static final int PVNO = 1;
+
+    private short messageLength;
+    private short versionNumber;
+    private short authHeaderLength;
+
+    protected AbstractPasswordMessage( short messageLength, short versionNumber,
+            short authHeaderLength )
+    {
+        this.messageLength = messageLength;
+        this.versionNumber = versionNumber;
+        this.authHeaderLength = authHeaderLength;
+    }
 
+    public short getMessageLength()
+    {
+        return messageLength;
+    }
+
+    public short getVersionNumber()
+    {
+        return versionNumber;
+    }
+
+    public short getAuthHeaderLength()
+    {
+        return authHeaderLength;
+    }
+}

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/AbstractPasswordMessageModifier.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/AbstractPasswordMessageModifier.java?rev=240387&r1=240386&r2=240387&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/AbstractPasswordMessageModifier.java (original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/AbstractPasswordMessageModifier.java Fri Aug 26 20:52:51 2005
@@ -16,20 +16,24 @@
  */
 package org.apache.changepw.messages;
 
-abstract public class AbstractPasswordMessageModifier {
-	
-	protected short _messageLength;
-	protected short _protocolVersionNumber;
-	protected short _authHeaderLength;
-	
-	public void setMessageLength(short length) {
-		_messageLength = length;
-	}
-	public void setProtocolVersionNumber(short versionNumber) {
-		_protocolVersionNumber = versionNumber;
-	}
-	public void setAuthHeaderLength(short length) {
-		_authHeaderLength = length;
-	}
-}
+abstract public class AbstractPasswordMessageModifier
+{
+    protected short messageLength;
+    protected short versionNumber;
+    protected short authHeaderLength;
+
+    public void setMessageLength( short messageLength )
+    {
+        this.messageLength = messageLength;
+    }
 
+    public void setProtocolVersionNumber( short versionNumber )
+    {
+        this.versionNumber = versionNumber;
+    }
+
+    public void setAuthHeaderLength( short authHeaderLength )
+    {
+        this.authHeaderLength = authHeaderLength;
+    }
+}

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordError.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordError.java?rev=240387&r1=240386&r2=240387&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordError.java (original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordError.java Fri Aug 26 20:52:51 2005
@@ -16,22 +16,22 @@
  */
 package org.apache.changepw.messages;
 
-import org.apache.kerberos.messages.*;
+import org.apache.kerberos.messages.ErrorMessage;
 
-public class ChangePasswordError extends AbstractPasswordMessage {
-	
-	private ErrorMessage _errorMessage;
-	
-	public ChangePasswordError(short messageLength, short versionNumber, short authHeaderLength,
-			ErrorMessage errorMessage) {
-		
-		super(messageLength, versionNumber, authHeaderLength);
-		
-		_errorMessage = errorMessage;
-	}
-	
-	public ErrorMessage getErrorMessage() {
-		return _errorMessage;
-	}
-}
+public class ChangePasswordError extends AbstractPasswordMessage
+{
+    private ErrorMessage errorMessage;
+
+    public ChangePasswordError( short messageLength, short versionNumber, short authHeaderLength,
+            ErrorMessage errorMessage )
+    {
+        super( messageLength, versionNumber, authHeaderLength );
 
+        this.errorMessage = errorMessage;
+    }
+
+    public ErrorMessage getErrorMessage()
+    {
+        return errorMessage;
+    }
+}

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordErrorModifier.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordErrorModifier.java?rev=240387&r1=240386&r2=240387&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordErrorModifier.java (original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordErrorModifier.java Fri Aug 26 20:52:51 2005
@@ -16,20 +16,20 @@
  */
 package org.apache.changepw.messages;
 
-import org.apache.kerberos.messages.*;
+import org.apache.kerberos.messages.ErrorMessage;
 
-public class ChangePasswordErrorModifier extends AbstractPasswordMessageModifier {
-	
-	private ErrorMessage _errorMessage;
-	
-	public ChangePasswordError getChangePasswordError() {
-		
-		return new ChangePasswordError(_messageLength, _protocolVersionNumber,
-			_authHeaderLength, _errorMessage);
-	}
-	
-	public void setErrorMessage(ErrorMessage errorMessage) {
-		_errorMessage = errorMessage;
-	}
-}
+public class ChangePasswordErrorModifier extends AbstractPasswordMessageModifier
+{
+    private ErrorMessage errorMessage;
+
+    public ChangePasswordError getChangePasswordError()
+    {
+        return new ChangePasswordError( messageLength, versionNumber, authHeaderLength,
+                errorMessage );
+    }
 
+    public void setErrorMessage( ErrorMessage errorMessage )
+    {
+        this.errorMessage = errorMessage;
+    }
+}

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordReply.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordReply.java?rev=240387&r1=240386&r2=240387&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordReply.java (original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordReply.java Fri Aug 26 20:52:51 2005
@@ -16,28 +16,30 @@
  */
 package org.apache.changepw.messages;
 
-import org.apache.kerberos.messages.application.*;
+import org.apache.kerberos.messages.application.ApplicationReply;
+import org.apache.kerberos.messages.application.PrivateMessage;
 
-public class ChangePasswordReply extends AbstractPasswordMessage {
-	
-	private ApplicationReply _applicationReply;
-	private PrivateMessage   _privateMessage;
-	
-	public ChangePasswordReply(short messageLength, short versionNumber, short authHeaderLength,
-			ApplicationReply appReply, PrivateMessage privateMessage) {
-		
-		super(messageLength, versionNumber, authHeaderLength);
-		
-		_applicationReply = appReply;
-		_privateMessage   = privateMessage;
-	}
-	
-	public ApplicationReply getApplicationReply() {
-		return _applicationReply;
-	}
-	
-	public PrivateMessage getPrivateMessage() {
-		return _privateMessage;
-	}
-}
+public class ChangePasswordReply extends AbstractPasswordMessage
+{
+    private ApplicationReply applicationReply;
+    private PrivateMessage privateMessage;
+
+    public ChangePasswordReply( short messageLength, short versionNumber, short authHeaderLength,
+            ApplicationReply applicationReply, PrivateMessage privateMessage )
+    {
+        super( messageLength, versionNumber, authHeaderLength );
+
+        this.applicationReply = applicationReply;
+        this.privateMessage = privateMessage;
+    }
 
+    public ApplicationReply getApplicationReply()
+    {
+        return applicationReply;
+    }
+
+    public PrivateMessage getPrivateMessage()
+    {
+        return privateMessage;
+    }
+}

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordReplyModifier.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordReplyModifier.java?rev=240387&r1=240386&r2=240387&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordReplyModifier.java (original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordReplyModifier.java Fri Aug 26 20:52:51 2005
@@ -16,24 +16,27 @@
  */
 package org.apache.changepw.messages;
 
-import org.apache.kerberos.messages.application.*;
+import org.apache.kerberos.messages.application.ApplicationReply;
+import org.apache.kerberos.messages.application.PrivateMessage;
 
-public class ChangePasswordReplyModifier extends AbstractPasswordMessageModifier {
-	
-	private ApplicationReply _appReply;
-	private PrivateMessage   _privateMessage;
-	
-	public ChangePasswordReply getChangePasswordReply() {
-		
-		return new ChangePasswordReply(_messageLength, _protocolVersionNumber,
-			_authHeaderLength, _appReply, _privateMessage);
-	}
-	
-	public void setApplicationReply(ApplicationReply applicationReply) {
-		_appReply = applicationReply;
-	}
-	public void setPrivateMessage(PrivateMessage privateMessage) {
-		_privateMessage = privateMessage;
-	}
-}
+public class ChangePasswordReplyModifier extends AbstractPasswordMessageModifier
+{
+    private ApplicationReply applicationReply;
+    private PrivateMessage privateMessage;
+
+    public ChangePasswordReply getChangePasswordReply()
+    {
+        return new ChangePasswordReply( messageLength, versionNumber, authHeaderLength,
+                applicationReply, privateMessage );
+    }
 
+    public void setApplicationReply( ApplicationReply applicationReply )
+    {
+        this.applicationReply = applicationReply;
+    }
+
+    public void setPrivateMessage( PrivateMessage privateMessage )
+    {
+        this.privateMessage = privateMessage;
+    }
+}

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordRequest.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordRequest.java?rev=240387&r1=240386&r2=240387&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordRequest.java (original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordRequest.java Fri Aug 26 20:52:51 2005
@@ -16,28 +16,30 @@
  */
 package org.apache.changepw.messages;
 
-import org.apache.kerberos.messages.*;
-import org.apache.kerberos.messages.application.*;
+import org.apache.kerberos.messages.ApplicationRequest;
+import org.apache.kerberos.messages.application.PrivateMessage;
 
-public class ChangePasswordRequest extends AbstractPasswordMessage {
-	
-	private ApplicationRequest _authHeader;
-	private PrivateMessage     _privateMessage;
-	
-	public ChangePasswordRequest(short messageLength, short versionNumber, short authHeaderLength,
-			ApplicationRequest authHeader, PrivateMessage privateMessage) {
-		
-		super(messageLength, versionNumber, authHeaderLength);
-		
-		_authHeader     = authHeader;
-		_privateMessage = privateMessage;
-	}
-	
-	public ApplicationRequest getAuthHeader() {
-		return _authHeader;
-	}
-	public PrivateMessage getPrivateMessage() {
-		return _privateMessage;
-	}
-}
+public class ChangePasswordRequest extends AbstractPasswordMessage
+{
+    private ApplicationRequest authHeader;
+    private PrivateMessage privateMessage;
+
+    public ChangePasswordRequest( short messageLength, short versionNumber, short authHeaderLength,
+            ApplicationRequest authHeader, PrivateMessage privateMessage )
+    {
+        super( messageLength, versionNumber, authHeaderLength );
+
+        this.authHeader = authHeader;
+        this.privateMessage = privateMessage;
+    }
 
+    public ApplicationRequest getAuthHeader()
+    {
+        return authHeader;
+    }
+
+    public PrivateMessage getPrivateMessage()
+    {
+        return privateMessage;
+    }
+}

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordRequestModifier.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordRequestModifier.java?rev=240387&r1=240386&r2=240387&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordRequestModifier.java (original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/messages/ChangePasswordRequestModifier.java Fri Aug 26 20:52:51 2005
@@ -16,25 +16,27 @@
  */
 package org.apache.changepw.messages;
 
-import org.apache.kerberos.messages.*;
-import org.apache.kerberos.messages.application.*;
+import org.apache.kerberos.messages.ApplicationRequest;
+import org.apache.kerberos.messages.application.PrivateMessage;
 
-public class ChangePasswordRequestModifier extends AbstractPasswordMessageModifier {
-	
-	private ApplicationRequest _authHeader;
-	private PrivateMessage     _privateMessage;
-	
-	public ChangePasswordRequest getChangePasswordMessage() {
-		
-		return new ChangePasswordRequest(_messageLength, _protocolVersionNumber,
-			_authHeaderLength, _authHeader, _privateMessage);
-	}
-	
-	public void setAuthHeader(ApplicationRequest authHeader) {
-		_authHeader = authHeader;
-	}
-	public void setPrivateMessage(PrivateMessage privateMessage) {
-		_privateMessage = privateMessage;
-	}
-}
+public class ChangePasswordRequestModifier extends AbstractPasswordMessageModifier
+{
+    private ApplicationRequest authHeader;
+    private PrivateMessage privateMessage;
+
+    public ChangePasswordRequest getChangePasswordMessage()
+    {
+        return new ChangePasswordRequest( messageLength, versionNumber,
+                authHeaderLength, authHeader, privateMessage );
+    }
 
+    public void setAuthHeader( ApplicationRequest authHeader )
+    {
+        this.authHeader = authHeader;
+    }
+
+    public void setPrivateMessage( PrivateMessage privateMessage )
+    {
+        this.privateMessage = privateMessage;
+    }
+}

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/protocol/ChangePasswordDecoder.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/protocol/ChangePasswordDecoder.java?rev=240387&r1=240386&r2=240387&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/protocol/ChangePasswordDecoder.java (original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/protocol/ChangePasswordDecoder.java Fri Aug 26 20:52:51 2005
@@ -26,7 +26,6 @@
 import org.apache.mina.protocol.ProtocolSession;
 import org.apache.mina.protocol.ProtocolViolationException;
 
-
 public class ChangePasswordDecoder implements ProtocolDecoder
 {
     public void decode( ProtocolSession session, ByteBuffer in, ProtocolDecoderOutput out )
@@ -34,13 +33,12 @@
     {
         ChangePasswordRequestDecoder decoder = new ChangePasswordRequestDecoder();
         try
-		{
-        	out.write( decoder.decode( in.buf() ) );
+        {
+            out.write( decoder.decode( in.buf() ) );
         }
-        catch ( IOException ioe)
-		{
-        	ioe.printStackTrace();
+        catch ( IOException ioe )
+        {
+            ioe.printStackTrace();
         }
     }
 }
-

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/protocol/ChangePasswordEncoder.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/protocol/ChangePasswordEncoder.java?rev=240387&r1=240386&r2=240387&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/protocol/ChangePasswordEncoder.java (original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/protocol/ChangePasswordEncoder.java Fri Aug 26 20:52:51 2005
@@ -29,50 +29,48 @@
 import org.apache.mina.protocol.ProtocolSession;
 import org.apache.mina.protocol.ProtocolViolationException;
 
-
 public class ChangePasswordEncoder implements ProtocolEncoder
 {
     public void encode( ProtocolSession session, Object message, ProtocolEncoderOutput out )
             throws ProtocolViolationException
     {
-    	ByteBuffer buf = ByteBuffer.allocate( 512 );
-    	
-    	try
-		{
-	    	if ( message instanceof ChangePasswordReply )
-	    	{
-	    		encodeReply( (ChangePasswordReply)message, buf );
-	    	}
-	    	else
-	    	{
-	        	if ( message instanceof ChangePasswordError )
-	        	{
-	        		encodeError( (ChangePasswordError)message, buf );
-	        	}
-	    	}
-	    	
-	        buf.flip();
-	        
-	        out.write( buf );
-		}
-    	catch ( IOException ioe )
-		{
-    		throw new ProtocolViolationException();
-		}
+        ByteBuffer buf = ByteBuffer.allocate( 512 );
+
+        try
+        {
+            if ( message instanceof ChangePasswordReply )
+            {
+                encodeReply( (ChangePasswordReply) message, buf );
+            }
+            else
+            {
+                if ( message instanceof ChangePasswordError )
+                {
+                    encodeError( (ChangePasswordError) message, buf );
+                }
+            }
+
+            buf.flip();
+
+            out.write( buf );
+        }
+        catch ( IOException ioe )
+        {
+            throw new ProtocolViolationException();
+        }
     }
-    
+
     private void encodeReply( ChangePasswordReply reply, ByteBuffer buf ) throws IOException
     {
-    	ChangePasswordReplyEncoder encoder = new ChangePasswordReplyEncoder();
-    	
+        ChangePasswordReplyEncoder encoder = new ChangePasswordReplyEncoder();
+
         encoder.encode( buf.buf(), reply );
     }
-    
+
     private void encodeError( ChangePasswordError error, ByteBuffer buf ) throws IOException
     {
-    	ChangePasswordErrorEncoder encoder = new ChangePasswordErrorEncoder();
-    	
+        ChangePasswordErrorEncoder encoder = new ChangePasswordErrorEncoder();
+
         encoder.encode( buf.buf(), error );
     }
 }
-

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/protocol/ChangePasswordProtocolHandler.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/protocol/ChangePasswordProtocolHandler.java?rev=240387&r1=240386&r2=240387&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/protocol/ChangePasswordProtocolHandler.java (original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/protocol/ChangePasswordProtocolHandler.java Fri Aug 26 20:52:51 2005
@@ -27,20 +27,17 @@
 import org.apache.mina.protocol.ProtocolHandler;
 import org.apache.mina.protocol.ProtocolSession;
 
-
 public class ChangePasswordProtocolHandler implements ProtocolHandler
 {
-	private KdcConfiguration config;
-	private PrincipalStore store;
-	
-	
-	public ChangePasswordProtocolHandler( KdcConfiguration config, PrincipalStore store )
-    {
-		this.config = config;
-		this.store  = store;
-	}
-	
-	
+    private KdcConfiguration config;
+    private PrincipalStore store;
+
+    public ChangePasswordProtocolHandler( KdcConfiguration config, PrincipalStore store )
+    {
+        this.config = config;
+        this.store = store;
+    }
+
     public void sessionCreated( ProtocolSession session )
     {
         System.out.println( session.getRemoteAddress() + " CREATED" );
@@ -72,19 +69,19 @@
     public void messageReceived( ProtocolSession session, Object message )
     {
         System.out.println( session.getRemoteAddress() + " RCVD: " + message );
-        
+
         ChangePasswordService changepwService = new ChangePasswordServiceImpl( config, store );
-        
+
         try
-		{
-            ChangePasswordReply reply = changepwService.getReplyFor( (ChangePasswordRequest)message );
-            
+        {
+            ChangePasswordReply reply = changepwService.getReplyFor( (ChangePasswordRequest) message );
+
             session.write( reply );
-		}
-        catch ( Exception e)
-		{
-        	e.printStackTrace();
-		}
+        }
+        catch ( Exception e )
+        {
+            e.printStackTrace();
+        }
     }
 
     public void messageSent( ProtocolSession session, Object message )
@@ -92,4 +89,3 @@
         System.out.println( session.getRemoteAddress() + " SENT: " + message );
     }
 }
-

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/protocol/ChangePasswordProtocolProvider.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/protocol/ChangePasswordProtocolProvider.java?rev=240387&r1=240386&r2=240387&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/protocol/ChangePasswordProtocolProvider.java (original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/protocol/ChangePasswordProtocolProvider.java Fri Aug 26 20:52:51 2005
@@ -25,12 +25,11 @@
 import org.apache.mina.protocol.ProtocolHandler;
 import org.apache.mina.protocol.ProtocolProvider;
 
-
 public class ChangePasswordProtocolProvider implements ProtocolProvider
 {
     // Protocol handler is usually a singleton.
     private ProtocolHandler HANDLER;
-    
+
     // Codec factory is also usually a singleton.
     private static ProtocolCodecFactory CODEC_FACTORY = new ProtocolCodecFactory()
     {
@@ -46,14 +45,12 @@
             return new ChangePasswordDecoder();
         }
     };
-    
-    
-	public ChangePasswordProtocolProvider( KdcConfiguration config, PrincipalStore store )
+
+    public ChangePasswordProtocolProvider( KdcConfiguration config, PrincipalStore store )
     {
-		HANDLER = new ChangePasswordProtocolHandler( config, store );
-	}
-	
-	
+        HANDLER = new ChangePasswordProtocolHandler( config, store );
+    }
+
     public ProtocolCodecFactory getCodecFactory()
     {
         return CODEC_FACTORY;
@@ -64,4 +61,3 @@
         return HANDLER;
     }
 }
-

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ChangePasswordServiceImpl.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ChangePasswordServiceImpl.java?rev=240387&r1=240386&r2=240387&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ChangePasswordServiceImpl.java (original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/service/ChangePasswordServiceImpl.java Fri Aug 26 20:52:51 2005
@@ -113,7 +113,7 @@
 		
 		ChangePasswordData passwordData = null;
 		
-		if ( request.getProtocolVersionNumber() == (short)1 )
+		if ( request.getVersionNumber() == (short)1 )
 		{
 			// Use protocol version 0x0001, the legacy Kerberos change password protocol
 			ChangePasswordDataModifier modifier = new ChangePasswordDataModifier();
@@ -132,7 +132,7 @@
 		// ignore r-address
 		
 		// generate key from password
-		String password = new String( passwordData.getNewPassword() );
+		String password = new String( passwordData.getPassword() );
 		KerberosPrincipal clientPrincipal = authenticator.getClientPrincipal();
 		KerberosKey newKey = new KerberosKey( clientPrincipal, password.toCharArray(), "DES" );
 		

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/value/ChangePasswordData.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/value/ChangePasswordData.java?rev=240387&r1=240386&r2=240387&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/value/ChangePasswordData.java (original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/value/ChangePasswordData.java Fri Aug 26 20:52:51 2005
@@ -16,28 +16,33 @@
  */
 package org.apache.changepw.value;
 
-import org.apache.kerberos.messages.value.*;
+import org.apache.kerberos.messages.value.PrincipalName;
 
-public class ChangePasswordData {
-	
-	private byte[]        _newPassword;
-	private PrincipalName _targetName;
-	private String        _targetRealm;
-	
-	public ChangePasswordData(byte[] password, PrincipalName name, String realm) {
-		_newPassword = password;
-		_targetName  = name;
-		_targetRealm = realm;
-	}
-	
-	public byte[] getNewPassword() {
-		return _newPassword;
-	}
-	public PrincipalName getTargetName() {
-		return _targetName;
-	}
-	public String getTargetRealm() {
-		return _targetRealm;
-	}
-}
+public class ChangePasswordData
+{
+    private byte[] password;
+    private PrincipalName principalName;
+    private String realm;
+
+    public ChangePasswordData( byte[] password, PrincipalName principalName, String realm )
+    {
+        this.password = password;
+        this.principalName = principalName;
+        this.realm = realm;
+    }
+
+    public byte[] getPassword()
+    {
+        return password;
+    }
 
+    public PrincipalName getPrincipalName()
+    {
+        return principalName;
+    }
+
+    public String getRealm()
+    {
+        return realm;
+    }
+}

Modified: directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/value/ChangePasswordDataModifier.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/value/ChangePasswordDataModifier.java?rev=240387&r1=240386&r2=240387&view=diff
==============================================================================
--- directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/value/ChangePasswordDataModifier.java (original)
+++ directory/protocol-providers/changepw/trunk/src/java/org/apache/changepw/value/ChangePasswordDataModifier.java Fri Aug 26 20:52:51 2005
@@ -16,26 +16,31 @@
  */
 package org.apache.changepw.value;
 
-import org.apache.kerberos.messages.value.*;
+import org.apache.kerberos.messages.value.PrincipalName;
 
-public class ChangePasswordDataModifier {
-	
-	private byte[]        _newPassword;
-	private PrincipalName _targetName;
-	private String        _targetRealm;
-	
-	public ChangePasswordData getChangePasswdData() {
-		return new ChangePasswordData(_newPassword, _targetName, _targetRealm);
-	}
-	
-	public void setNewPassword(byte[] password) {
-		_newPassword = password;
-	}
-	public void setTargetName(PrincipalName name) {
-		_targetName = name;
-	}
-	public void setTargetRealm(String realm) {
-		_targetRealm = realm;
-	}
-}
+public class ChangePasswordDataModifier
+{
+    private byte[] password;
+    private PrincipalName principalName;
+    private String realm;
+
+    public ChangePasswordData getChangePasswdData()
+    {
+        return new ChangePasswordData( password, principalName, realm );
+    }
+
+    public void setNewPassword( byte[] password )
+    {
+        this.password = password;
+    }
 
+    public void setTargetName( PrincipalName principalName )
+    {
+        this.principalName = principalName;
+    }
+
+    public void setTargetRealm( String realm )
+    {
+        this.realm = realm;
+    }
+}



Mime
View raw message