directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r125327 - in incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos: io/encoder kdc
Date Sun, 16 Jan 2005 01:21:12 GMT
Author: erodriguez
Date: Sat Jan 15 17:21:12 2005
New Revision: 125327

URL: http://svn.apache.org/viewcvs?view=rev&rev=125327
Log:
KDC dispatcher no longer needed; replaced with MINA front-end conventions.
Removed:
   incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/kdc/KdcDispatcher.java
Modified:
   incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/encoder/ErrorMessageEncoder.java
   incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/encoder/KdcReplyEncoder.java
   incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/encoder/KerberosMessageEncoder.java

Modified: incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/encoder/ErrorMessageEncoder.java
Url: http://svn.apache.org/viewcvs/incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/encoder/ErrorMessageEncoder.java?view=diff&rev=125327&p1=incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/encoder/ErrorMessageEncoder.java&r1=125326&p2=incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/encoder/ErrorMessageEncoder.java&r2=125327
==============================================================================
--- incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/encoder/ErrorMessageEncoder.java
(original)
+++ incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/encoder/ErrorMessageEncoder.java
Sat Jan 15 17:21:12 2005
@@ -19,7 +19,7 @@
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-import java.io.OutputStream;
+import java.nio.ByteBuffer;
 
 import org.apache.asn1.der.ASN1EncodableVector;
 import org.apache.asn1.der.ASN1OutputStream;
@@ -31,18 +31,16 @@
 import org.apache.asn1.der.DERTaggedObject;
 import org.apache.kerberos.messages.ErrorMessage;
 
-public class ErrorMessageEncoder extends KerberosMessageEncoder {
-	
-	public OutputStream encode(ErrorMessage message, OutputStream os) throws IOException {
+public class ErrorMessageEncoder extends KerberosMessageEncoder
+{
+	public void encode( ErrorMessage message, ByteBuffer out ) throws IOException
+	{
+		ASN1OutputStream aos = new ASN1OutputStream( newOutputStream( out ) );
 		
-		ASN1OutputStream aos = new ASN1OutputStream(os);
-		
-		DERSequence errorReply = encodeErrorMessageSequence(message);
-		aos.writeObject(new DERApplicationSpecific(message.getMessageType().getOrdinal(), errorReply));
+		DERSequence errorReply = encodeErrorMessageSequence( message );
+		aos.writeObject( new DERApplicationSpecific( message.getMessageType().getOrdinal(), errorReply
) );
 		
 		aos.close();
-		
-		return aos;
 	}
 	
 	public byte[] encode(ErrorMessage message) throws IOException {

Modified: incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/encoder/KdcReplyEncoder.java
Url: http://svn.apache.org/viewcvs/incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/encoder/KdcReplyEncoder.java?view=diff&rev=125327&p1=incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/encoder/KdcReplyEncoder.java&r1=125326&p2=incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/encoder/KdcReplyEncoder.java&r2=125327
==============================================================================
--- incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/encoder/KdcReplyEncoder.java
(original)
+++ incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/encoder/KdcReplyEncoder.java
Sat Jan 15 17:21:12 2005
@@ -18,7 +18,7 @@
 package org.apache.kerberos.io.encoder;
 
 import java.io.IOException;
-import java.io.OutputStream;
+import java.nio.ByteBuffer;
 
 import org.apache.asn1.der.ASN1EncodableVector;
 import org.apache.asn1.der.ASN1OutputStream;
@@ -30,23 +30,22 @@
 import org.apache.kerberos.messages.KdcReply;
 import org.apache.kerberos.messages.value.PreAuthenticationData;
 
-public class KdcReplyEncoder extends KerberosMessageEncoder {
+public class KdcReplyEncoder extends KerberosMessageEncoder
+{
 	/*
  	AS-REP ::=    [APPLICATION 11] KDC-REP
  	TGS-REP ::=   [APPLICATION 13] KDC-REP
 	 */
-	public OutputStream encode(KdcReply app, OutputStream os) throws IOException {
+	public void encode( KdcReply app, ByteBuffer out ) throws IOException
+	{
+		ASN1OutputStream aos = new ASN1OutputStream( newOutputStream( out ) );
 		
-		ASN1OutputStream aos = new ASN1OutputStream(os);
-		
-		DERSequence kdcrep = encodeKdcReplySequence(app);
-		aos.writeObject(new DERApplicationSpecific(app.getMessageType().getOrdinal(), kdcrep));
+		DERSequence kdcrep = encodeKdcReplySequence( app );
+		aos.writeObject( new DERApplicationSpecific( app.getMessageType().getOrdinal(), kdcrep
) );
 		
 		aos.close();
-		
-		return aos;
 	}
-
+	
 	/*
 	KDC-REP ::=   SEQUENCE {
 	              pvno[0]                    INTEGER,

Modified: incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/encoder/KerberosMessageEncoder.java
Url: http://svn.apache.org/viewcvs/incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/encoder/KerberosMessageEncoder.java?view=diff&rev=125327&p1=incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/encoder/KerberosMessageEncoder.java&r1=125326&p2=incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/encoder/KerberosMessageEncoder.java&r2=125327
==============================================================================
--- incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/encoder/KerberosMessageEncoder.java
(original)
+++ incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/io/encoder/KerberosMessageEncoder.java
Sat Jan 15 17:21:12 2005
@@ -17,6 +17,9 @@
 
 package org.apache.kerberos.io.encoder;
 
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
@@ -49,7 +52,23 @@
 import org.apache.kerberos.messages.value.TicketFlags;
 import org.apache.kerberos.messages.value.TransitedEncoding;
 
-public abstract class KerberosMessageEncoder {
+public abstract class KerberosMessageEncoder
+{
+	public static OutputStream newOutputStream( final ByteBuffer buf )
+	{
+        return new OutputStream()
+		{
+            public synchronized void write( int b ) throws IOException
+			{
+                buf.put( (byte)b );
+            }
+    
+            public synchronized void write( byte[] bytes, int off, int len ) throws IOException
+			{
+                buf.put( bytes, off, len );
+            }
+        };
+    }
 	
 	/*
 	PrincipalName ::=   SEQUENCE {

Deleted: /incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/kdc/KdcDispatcher.java
Url: http://svn.apache.org/viewcvs/incubator/directory/kerberos/trunk/core/src/java/org/apache/kerberos/kdc/KdcDispatcher.java?view=auto&rev=125326
==============================================================================

Mime
View raw message