directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r153004 - in incubator/directory/protocols/kerberos/trunk/core/src/java/org/apache/kerberos/messages: MessageType.java value/PreAuthenticationDataType.java
Date Wed, 09 Feb 2005 04:53:08 GMT
Author: erodriguez
Date: Tue Feb  8 20:53:04 2005
New Revision: 153004

URL: http://svn.apache.org/viewcvs?view=rev&rev=153004
Log:
Reformatted typesafe enumerators.

Modified:
    incubator/directory/protocols/kerberos/trunk/core/src/java/org/apache/kerberos/messages/MessageType.java
    incubator/directory/protocols/kerberos/trunk/core/src/java/org/apache/kerberos/messages/value/PreAuthenticationDataType.java

Modified: incubator/directory/protocols/kerberos/trunk/core/src/java/org/apache/kerberos/messages/MessageType.java
URL: http://svn.apache.org/viewcvs/incubator/directory/protocols/kerberos/trunk/core/src/java/org/apache/kerberos/messages/MessageType.java?view=diff&r1=153003&r2=153004
==============================================================================
--- incubator/directory/protocols/kerberos/trunk/core/src/java/org/apache/kerberos/messages/MessageType.java
(original)
+++ incubator/directory/protocols/kerberos/trunk/core/src/java/org/apache/kerberos/messages/MessageType.java
Tue Feb  8 20:53:04 2005
@@ -14,69 +14,84 @@
  *   limitations under the License.
  *
  */
+
 package org.apache.kerberos.messages;
 
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
 
-public final class MessageType implements Comparable {
 
+public final class MessageType implements Comparable
+{
 	/**
 	 * Enumeration elements are constructed once upon class loading.
 	 * Order of appearance here determines the order of compareTo.
 	 */
-	public static final MessageType NULL            = new MessageType(0,  "null");
-	public static final MessageType KRB_AS_REQ      = new MessageType(10, "initial authentication
request");
-	public static final MessageType KRB_AS_REP      = new MessageType(11, "initial authentication
response");
-	public static final MessageType KRB_TGS_REQ     = new MessageType(12, "request for authentication
based on TGT");
-	public static final MessageType KRB_TGS_REP     = new MessageType(13, "response to authentication
based on TGT");
-	public static final MessageType KRB_AP_REQ      = new MessageType(14, "application request");
-	public static final MessageType KRB_AP_REP      = new MessageType(15, "application response");
-	public static final MessageType KRB_SAFE        = new MessageType(20, "safe (checksummed)
application message");
-	public static final MessageType KRB_PRIV        = new MessageType(21, "private (encrypted)
application message");
-	public static final MessageType KRB_CRED        = new MessageType(22, "private (encrypted)
message to forward credentials");
-	public static final MessageType ENC_AP_REP_PART = new MessageType(27, "encrypted application
reply part");
-	public static final MessageType ENC_PRIV_PART   = new MessageType(28, "encrypted private
message part");
-	public static final MessageType KRB_ERROR       = new MessageType(30, "error response");
-
-	public String toString() {
-		return _fName + " (" + _fOrdinal + ")";
+	public static final MessageType NULL            = new MessageType( 0,  "null" );
+	public static final MessageType KRB_AS_REQ      = new MessageType( 10, "initial authentication
request" );
+	public static final MessageType KRB_AS_REP      = new MessageType( 11, "initial authentication
response" );
+	public static final MessageType KRB_TGS_REQ     = new MessageType( 12, "request for authentication
based on TGT" );
+	public static final MessageType KRB_TGS_REP     = new MessageType( 13, "response to authentication
based on TGT" );
+	public static final MessageType KRB_AP_REQ      = new MessageType( 14, "application request"
);
+	public static final MessageType KRB_AP_REP      = new MessageType( 15, "application response"
);
+	public static final MessageType KRB_SAFE        = new MessageType( 20, "safe (checksummed)
application message" );
+	public static final MessageType KRB_PRIV        = new MessageType( 21, "private (encrypted)
application message" );
+	public static final MessageType KRB_CRED        = new MessageType( 22, "private (encrypted)
message to forward credentials" );
+	public static final MessageType ENC_AP_REP_PART = new MessageType( 27, "encrypted application
reply part" );
+	public static final MessageType ENC_PRIV_PART   = new MessageType( 28, "encrypted private
message part" );
+	public static final MessageType KRB_ERROR       = new MessageType( 30, "error response"
);
+	
+	/** Array for building a List of VALUES. */
+	private static final MessageType[] values = {
+	    NULL, KRB_AS_REQ, KRB_AS_REP, KRB_TGS_REQ, KRB_TGS_REP, KRB_AP_REQ, KRB_AP_REP,
+	    KRB_SAFE, KRB_PRIV, KRB_CRED, ENC_AP_REP_PART, ENC_PRIV_PART, KRB_ERROR
+	};
+	
+	/** A list of all the message type constants. */
+	public static final List VALUES = Collections.unmodifiableList( Arrays.asList( values )
);
+	
+	/** the name of the message type */
+	private final String name;
+	
+	/** the value/code for the message type */
+	private final int ordinal;
+	
+	/**
+	 * Private constructor prevents construction outside of this class.
+	 */
+	private MessageType( int ordinal, String name )
+	{
+		this.ordinal = ordinal;
+		this.name    = name;
 	}
-
-	public int compareTo(Object that) {
-		return _fOrdinal - ((MessageType) that)._fOrdinal;
+	
+	public String toString()
+	{
+		return name + " (" + ordinal + ")";
 	}
-
-	public static MessageType getTypeByOrdinal(int type) {
-		for (int i = 0; i < fValues.length; i++)
-			if (fValues[i]._fOrdinal == type)
-				return fValues[i];
-		return NULL;
+	
+	public int compareTo( Object that )
+	{
+		return ordinal - ( (MessageType) that ).ordinal;
 	}
 	
-	public int getOrdinal() {
-		return _fOrdinal;
+	public static MessageType getTypeByOrdinal( int type )
+	{
+		for ( int ii = 0; ii < values.length; ii++ )
+		{
+			if ( values[ ii ].ordinal == type )
+			{
+				return values[ ii ];
+			}
+		}
+		
+		return NULL;
 	}
-
-	/// PRIVATE /////
-	private final String _fName;
-	private final int    _fOrdinal;
-
-	/**
-	 * Private constructor prevents construction outside of this class.
-	 */
-	private MessageType(int ordinal, String name) {
-		_fOrdinal = ordinal;
-		_fName    = name;
+	
+	public int getOrdinal()
+	{
+		return ordinal;
 	}
-
-	/**
-	 * These two lines are all that's necessary to export a List of VALUES.
-	 */
-	private static final MessageType[] fValues = {NULL, KRB_AS_REQ, KRB_AS_REP, KRB_TGS_REQ,
-			KRB_TGS_REP, KRB_AP_REQ, KRB_AP_REP, KRB_SAFE, KRB_PRIV, KRB_CRED,
-			ENC_AP_REP_PART, ENC_PRIV_PART, KRB_ERROR};
-	// VALUES needs to be located here, otherwise illegal forward reference
-	public static final List VALUES = Collections.unmodifiableList(Arrays.asList(fValues));
-
 }
 

Modified: incubator/directory/protocols/kerberos/trunk/core/src/java/org/apache/kerberos/messages/value/PreAuthenticationDataType.java
URL: http://svn.apache.org/viewcvs/incubator/directory/protocols/kerberos/trunk/core/src/java/org/apache/kerberos/messages/value/PreAuthenticationDataType.java?view=diff&r1=153003&r2=153004
==============================================================================
--- incubator/directory/protocols/kerberos/trunk/core/src/java/org/apache/kerberos/messages/value/PreAuthenticationDataType.java
(original)
+++ incubator/directory/protocols/kerberos/trunk/core/src/java/org/apache/kerberos/messages/value/PreAuthenticationDataType.java
Tue Feb  8 20:53:04 2005
@@ -38,7 +38,7 @@
 	public static final PreAuthenticationDataType PA_OSF_DCE             = new PreAuthenticationDataType(
8, "OSF DCE" );
 	public static final PreAuthenticationDataType PA_CYBERSAFE_SECUREID  = new PreAuthenticationDataType(
9, "cybersafe secureid" );
 	public static final PreAuthenticationDataType PA_ASF3_SALT           = new PreAuthenticationDataType(
10, "ASF3 salt" );
-	public static final PreAuthenticationDataType PA_ETYPE_INFO          = new PreAuthenticationDataType(
11, "encryption info" );
+	public static final PreAuthenticationDataType PA_ENCTYPE_INFO        = new PreAuthenticationDataType(
11, "Encryption info." );
 	public static final PreAuthenticationDataType SAM_CHALLENGE          = new PreAuthenticationDataType(
12, "SAM challenge." );
 	public static final PreAuthenticationDataType SAM_RESPONSE           = new PreAuthenticationDataType(
13, "SAM response." );
 	public static final PreAuthenticationDataType PA_PK_AS_REQ           = new PreAuthenticationDataType(
14, "PK as request" );
@@ -47,11 +47,37 @@
 	public static final PreAuthenticationDataType SAM_REDIRECT           = new PreAuthenticationDataType(
21, "SAM redirect." );
 	public static final PreAuthenticationDataType PA_GET_FROM_TYPED_DATA = new PreAuthenticationDataType(
22, "Get from typed data" );
 	
+	/** Array for building a List of VALUES. */
+	private static final PreAuthenticationDataType[] values = {
+	    NULL, PA_TGS_REQ, PA_ENC_TIMESTAMP, PA_PW_SALT, PA_ENC_UNIX_TIME, PA_SANDIA_SECUREID,
+	    PA_SESAME, PA_OSF_DCE, PA_CYBERSAFE_SECUREID, PA_ASF3_SALT, PA_ENCTYPE_INFO,
+		SAM_CHALLENGE, SAM_RESPONSE, PA_PK_AS_REQ, PA_PK_AS_REP, PA_USE_SPECIFIED_KVNO,
+		SAM_REDIRECT, PA_GET_FROM_TYPED_DATA
+	};
+	
+	/** A list of all the pre-authentication type constants. */
+	public static final List VALUES = Collections.unmodifiableList( Arrays.asList( values )
);
+	
+	/** The name of the pre-authentication type. */
+	private final String name;
+	
+	/** The value/code for the pre-authentication type. */
+	private final int ordinal;
+	
+	/**
+	 * Private constructor prevents construction outside of this class.
+	 */
+	private PreAuthenticationDataType( int ordinal, String name )
+	{
+		this.ordinal = ordinal;
+		this.name    = name;
+	}
+	
 	public String toString()
 	{
 		return name + " (" + ordinal + ")";
 	}
-
+	
 	public int compareTo( Object that )
 	{
 		return ordinal - ( (PreAuthenticationDataType) that ).ordinal;
@@ -74,29 +100,5 @@
 	{
 		return ordinal;
 	}
-
-	/// PRIVATE /////
-	private final String name;
-	private final int    ordinal;
-
-	/**
-	 * Private constructor prevents construction outside of this class.
-	 */
-	private PreAuthenticationDataType( int ordinal, String name )
-	{
-		this.ordinal = ordinal;
-		this.name    = name;
-	}
-
-	/**
-	 * These two lines are all that's necessary to export a List of VALUES.
-	 */
-	private static final PreAuthenticationDataType[] values = { NULL, PA_TGS_REQ,
-			PA_ENC_TIMESTAMP, PA_PW_SALT, PA_ENC_UNIX_TIME, PA_SANDIA_SECUREID,
-			PA_SESAME, PA_OSF_DCE, PA_CYBERSAFE_SECUREID, PA_ASF3_SALT, PA_ETYPE_INFO,
-			SAM_CHALLENGE, SAM_RESPONSE, PA_PK_AS_REQ, PA_PK_AS_REP, PA_USE_SPECIFIED_KVNO,
-			SAM_REDIRECT, PA_GET_FROM_TYPED_DATA };
-	// VALUES needs to be located here, otherwise illegal forward reference
-	public static final List VALUES = Collections.unmodifiableList( Arrays.asList( values )
);
 }
 



Mime
View raw message