directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r233377 - in /directory/protocol-providers/kerberos/branches/refactor-to-chain/src/java/org/apache/kerberos/protocol: KerberosDecoder.java KerberosEncoder.java KerberosProtocolHandler.java KerberosProtocolProvider.java
Date Thu, 18 Aug 2005 21:04:41 GMT
Author: erodriguez
Date: Thu Aug 18 14:04:37 2005
New Revision: 233377

URL: http://svn.apache.org/viewcvs?rev=233377&view=rev
Log:
Reformatting:  imports, whitespace, line breaks, or code convention.

Modified:
    directory/protocol-providers/kerberos/branches/refactor-to-chain/src/java/org/apache/kerberos/protocol/KerberosDecoder.java
    directory/protocol-providers/kerberos/branches/refactor-to-chain/src/java/org/apache/kerberos/protocol/KerberosEncoder.java
    directory/protocol-providers/kerberos/branches/refactor-to-chain/src/java/org/apache/kerberos/protocol/KerberosProtocolHandler.java
    directory/protocol-providers/kerberos/branches/refactor-to-chain/src/java/org/apache/kerberos/protocol/KerberosProtocolProvider.java

Modified: directory/protocol-providers/kerberos/branches/refactor-to-chain/src/java/org/apache/kerberos/protocol/KerberosDecoder.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/kerberos/branches/refactor-to-chain/src/java/org/apache/kerberos/protocol/KerberosDecoder.java?rev=233377&r1=233376&r2=233377&view=diff
==============================================================================
--- directory/protocol-providers/kerberos/branches/refactor-to-chain/src/java/org/apache/kerberos/protocol/KerberosDecoder.java
(original)
+++ directory/protocol-providers/kerberos/branches/refactor-to-chain/src/java/org/apache/kerberos/protocol/KerberosDecoder.java
Thu Aug 18 14:04:37 2005
@@ -14,7 +14,6 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.protocol;
 
 import java.io.IOException;
@@ -26,22 +25,20 @@
 import org.apache.mina.protocol.ProtocolSession;
 import org.apache.mina.protocol.ProtocolViolationException;
 
-
 public class KerberosDecoder implements ProtocolDecoder
 {
-	private KdcRequestDecoder decoder = new KdcRequestDecoder();
-	
+    private KdcRequestDecoder decoder = new KdcRequestDecoder();
+
     public void decode( ProtocolSession session, ByteBuffer in, ProtocolDecoderOutput out
)
             throws ProtocolViolationException
     {
         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/kerberos/branches/refactor-to-chain/src/java/org/apache/kerberos/protocol/KerberosEncoder.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/kerberos/branches/refactor-to-chain/src/java/org/apache/kerberos/protocol/KerberosEncoder.java?rev=233377&r1=233376&r2=233377&view=diff
==============================================================================
--- directory/protocol-providers/kerberos/branches/refactor-to-chain/src/java/org/apache/kerberos/protocol/KerberosEncoder.java
(original)
+++ directory/protocol-providers/kerberos/branches/refactor-to-chain/src/java/org/apache/kerberos/protocol/KerberosEncoder.java
Thu Aug 18 14:04:37 2005
@@ -14,7 +14,6 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.protocol;
 
 import java.io.IOException;
@@ -29,39 +28,37 @@
 import org.apache.mina.protocol.ProtocolSession;
 import org.apache.mina.protocol.ProtocolViolationException;
 
-
 public class KerberosEncoder implements ProtocolEncoder
 {
-	private KdcReplyEncoder     replyEncoder = new KdcReplyEncoder();
-	private ErrorMessageEncoder errorEncoder = new ErrorMessageEncoder();
-	
+    private KdcReplyEncoder replyEncoder = new KdcReplyEncoder();
+    private ErrorMessageEncoder errorEncoder = new ErrorMessageEncoder();
+
     public void encode( ProtocolSession session, Object message, ProtocolEncoderOutput out
)
             throws ProtocolViolationException
     {
-    	ByteBuffer buf = ByteBuffer.allocate( 1024 );
-    	
-    	try
-		{
-	    	if ( message instanceof KdcReply )
-	    	{
-	    		replyEncoder.encode( (KdcReply)message, buf.buf() );
-	    	}
-	    	else
-	    	{
-	        	if ( message instanceof ErrorMessage )
-	        	{
-	        		errorEncoder.encode( (ErrorMessage)message, buf.buf() );
-	        	}
-	    	}
-	    	
-	        buf.flip();
-	        
-	        out.write( buf );
-		}
-    	catch ( IOException ioe )
-		{
-    		throw new ProtocolViolationException();
-		}
+        ByteBuffer buf = ByteBuffer.allocate( 1024 );
+
+        try
+        {
+            if ( message instanceof KdcReply )
+            {
+                replyEncoder.encode( (KdcReply) message, buf.buf() );
+            }
+            else
+            {
+                if ( message instanceof ErrorMessage )
+                {
+                    errorEncoder.encode( (ErrorMessage) message, buf.buf() );
+                }
+            }
+
+            buf.flip();
+
+            out.write( buf );
+        }
+        catch ( IOException ioe )
+        {
+            throw new ProtocolViolationException();
+        }
     }
 }
-

Modified: directory/protocol-providers/kerberos/branches/refactor-to-chain/src/java/org/apache/kerberos/protocol/KerberosProtocolHandler.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/kerberos/branches/refactor-to-chain/src/java/org/apache/kerberos/protocol/KerberosProtocolHandler.java?rev=233377&r1=233376&r2=233377&view=diff
==============================================================================
--- directory/protocol-providers/kerberos/branches/refactor-to-chain/src/java/org/apache/kerberos/protocol/KerberosProtocolHandler.java
(original)
+++ directory/protocol-providers/kerberos/branches/refactor-to-chain/src/java/org/apache/kerberos/protocol/KerberosProtocolHandler.java
Thu Aug 18 14:04:37 2005
@@ -14,16 +14,14 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.protocol;
 
 import java.io.IOException;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.kerberos.exceptions.ErrorType;
 import org.apache.kerberos.exceptions.KerberosException;
-import org.apache.kerberos.kdc.AuthenticationService;
-import org.apache.kerberos.kdc.ErrorService;
-import org.apache.kerberos.kdc.TicketGrantingService;
 import org.apache.kerberos.messages.AuthenticationReply;
 import org.apache.kerberos.messages.ErrorMessage;
 import org.apache.kerberos.messages.KdcRequest;
@@ -33,9 +31,6 @@
 import org.apache.mina.common.IdleStatus;
 import org.apache.mina.protocol.ProtocolHandler;
 import org.apache.mina.protocol.ProtocolSession;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.logging.Log;
-
 
 /**
  * The Kerberos protocol handler for MINA which handles requests for the authentication
@@ -47,16 +42,16 @@
 public class KerberosProtocolHandler implements ProtocolHandler
 {
     private static final Log log = LogFactory.getLog( KerberosProtocolHandler.class );
-	private AuthenticationService authService;
-	private TicketGrantingService tgsService;
-	private ErrorService          errorService;
-	
-	public KerberosProtocolHandler( KdcConfiguration config, PrincipalStore store )
-    {
-		errorService = new ErrorService( config );
-		authService  = new AuthenticationService( config, store );
-		tgsService   = new TicketGrantingService( config, store );
-	}
+    private AuthenticationService authService;
+    private TicketGrantingService tgsService;
+    private ErrorService errorService;
+
+    public KerberosProtocolHandler( KdcConfiguration config, PrincipalStore store )
+    {
+        errorService = new ErrorService( config );
+        authService = new AuthenticationService( config, store );
+        tgsService = new TicketGrantingService( config, store );
+    }
 
     public void sessionCreated( ProtocolSession session )
     {
@@ -103,42 +98,42 @@
             log.debug( session.getRemoteAddress() + " RCVD: " + message );
         }
 
-		try
-		{
-			KdcRequest request = ( KdcRequest ) message;
-			
-			int messageType = request.getMessageType().getOrdinal();
-			
-			switch ( messageType )
-			{
-				case 10:
-					AuthenticationReply authReply = authService.getReplyFor( request );
-					session.write( authReply );
-					break;
-				
-				case 12:
-					TicketGrantReply ticketReply = tgsService.getReplyFor( request );
-					session.write( ticketReply );
-		    		break;
-		    		
-		    	case 11:
-		    	case 13:
-		    		throw new KerberosException( ErrorType.KRB_AP_ERR_BADDIRECTION );
-		    		
-				default:
-					throw new KerberosException( ErrorType.KRB_AP_ERR_MSG_TYPE );
-			}
-		}
-		catch ( KerberosException ke )
-		{
-			log.error( "Returning error message:  " + ke.getMessage(), ke );
-			ErrorMessage errorMessage = errorService.getReplyFor( ke );
-			session.write( errorMessage );
-		}
-		catch ( IOException ioe )
-		{
-			log.error( ioe );
-		}
+        try
+        {
+            KdcRequest request = (KdcRequest) message;
+
+            int messageType = request.getMessageType().getOrdinal();
+
+            switch ( messageType )
+            {
+                case 10:
+                    AuthenticationReply authReply = authService.getReplyFor( request );
+                    session.write( authReply );
+                    break;
+
+                case 12:
+                    TicketGrantReply ticketReply = tgsService.getReplyFor( request );
+                    session.write( ticketReply );
+                    break;
+
+                case 11:
+                case 13:
+                    throw new KerberosException( ErrorType.KRB_AP_ERR_BADDIRECTION );
+
+                default:
+                    throw new KerberosException( ErrorType.KRB_AP_ERR_MSG_TYPE );
+            }
+        }
+        catch ( KerberosException ke )
+        {
+            log.error( "Returning error message:  " + ke.getMessage(), ke );
+            ErrorMessage errorMessage = errorService.getReplyFor( ke );
+            session.write( errorMessage );
+        }
+        catch ( IOException ioe )
+        {
+            log.error( ioe );
+        }
     }
 
     public void messageSent( ProtocolSession session, Object message )
@@ -149,4 +144,3 @@
         }
     }
 }
-

Modified: directory/protocol-providers/kerberos/branches/refactor-to-chain/src/java/org/apache/kerberos/protocol/KerberosProtocolProvider.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/kerberos/branches/refactor-to-chain/src/java/org/apache/kerberos/protocol/KerberosProtocolProvider.java?rev=233377&r1=233376&r2=233377&view=diff
==============================================================================
--- directory/protocol-providers/kerberos/branches/refactor-to-chain/src/java/org/apache/kerberos/protocol/KerberosProtocolProvider.java
(original)
+++ directory/protocol-providers/kerberos/branches/refactor-to-chain/src/java/org/apache/kerberos/protocol/KerberosProtocolProvider.java
Thu Aug 18 14:04:37 2005
@@ -14,7 +14,6 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.kerberos.protocol;
 
 import org.apache.kerberos.service.KdcConfiguration;
@@ -25,7 +24,6 @@
 import org.apache.mina.protocol.ProtocolHandler;
 import org.apache.mina.protocol.ProtocolProvider;
 
-
 public class KerberosProtocolProvider implements ProtocolProvider
 {
     // Protocol handler is usually a singleton.
@@ -47,10 +45,10 @@
         }
     };
 
-	public KerberosProtocolProvider( KdcConfiguration config, PrincipalStore store )
+    public KerberosProtocolProvider( KdcConfiguration config, PrincipalStore store )
     {
-		HANDLER = new KerberosProtocolHandler( config, store );
-	}
+        HANDLER = new KerberosProtocolHandler( config, store );
+    }
 
     public ProtocolCodecFactory getCodecFactory()
     {
@@ -62,4 +60,3 @@
         return HANDLER;
     }
 }
-



Mime
View raw message