You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by er...@apache.org on 2005/03/17 04:23:08 UTC

svn commit: r157875 - in directory: protocol-providers/kerberos/trunk/core/src/java/org/apache/kerberos/messages/value/ protocol-providers/kerberos/trunk/core/src/java/org/apache/kerberos/sam/ shared/kerberos/trunk/common/src/java/org/apache/kerberos/store/

Author: erodriguez
Date: Wed Mar 16 19:23:06 2005
New Revision: 157875

URL: http://svn.apache.org/viewcvs?view=rev&rev=157875
Log:
Moved SamType to value package.

Added:
    directory/protocol-providers/kerberos/trunk/core/src/java/org/apache/kerberos/messages/value/SamType.java
Removed:
    directory/protocol-providers/kerberos/trunk/core/src/java/org/apache/kerberos/sam/SamType.java
Modified:
    directory/protocol-providers/kerberos/trunk/core/src/java/org/apache/kerberos/sam/SamException.java
    directory/protocol-providers/kerberos/trunk/core/src/java/org/apache/kerberos/sam/SamVerifier.java
    directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/store/LookupPrincipalActionImpl.java
    directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/store/PrincipalStoreEntry.java
    directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/store/PrincipalStoreEntryModifier.java

Added: directory/protocol-providers/kerberos/trunk/core/src/java/org/apache/kerberos/messages/value/SamType.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/kerberos/trunk/core/src/java/org/apache/kerberos/messages/value/SamType.java?view=auto&rev=157875
==============================================================================
--- directory/protocol-providers/kerberos/trunk/core/src/java/org/apache/kerberos/messages/value/SamType.java (added)
+++ directory/protocol-providers/kerberos/trunk/core/src/java/org/apache/kerberos/messages/value/SamType.java Wed Mar 16 19:23:06 2005
@@ -0,0 +1,140 @@
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.kerberos.messages.value;
+
+
+import java.util.List;
+import java.util.Arrays;
+import java.util.Collections;
+
+
+/**
+ * Type safe enumeration of Single-use Authentication Mechanism types
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public final class SamType implements Comparable
+{
+	/*
+	 * Enumeration elements are constructed once upon class loading.
+	 * Order of appearance here determines the order of compareTo.
+	 */
+
+    /** safe SAM type enum for Enigma Logic */
+	public static final SamType PA_SAM_TYPE_ENIGMA = new SamType( 1, "Enigma Logic" );
+
+    /** safe SAM type enum for Digital Pathways */
+	public static final SamType PA_SAM_TYPE_DIGI_PATH = new SamType( 2, "Digital Pathways" );
+
+    /** safe SAM type enum for S/key where KDC has key 0 */
+	public static final SamType PA_SAM_TYPE_SKEY_K0 = new SamType( 3, "S/key where KDC has key 0" );
+
+    /** safe SAM type enum for Traditional S/Key */
+	public static final SamType PA_SAM_TYPE_SKEY = new SamType( 4, "Traditional S/Key" );
+
+    /** safe SAM type enum for Security Dynamics */
+	public static final SamType PA_SAM_TYPE_SECURID = new SamType( 5, "Security Dynamics" );
+
+    /** safe SAM type enum for CRYPTOCard */
+	public static final SamType PA_SAM_TYPE_CRYPTOCARD = new SamType( 6, "CRYPTOCard" );
+
+    /** safe SAM type enum for Apache Software Foundation */
+	public static final SamType PA_SAM_TYPE_APACHE = new SamType( 7, "Apache Software Foundation" );
+
+    /** Array for building a List of VALUES. */
+    private static final SamType[] values = {
+        PA_SAM_TYPE_ENIGMA, PA_SAM_TYPE_DIGI_PATH, PA_SAM_TYPE_SKEY_K0,
+        PA_SAM_TYPE_SKEY, PA_SAM_TYPE_SECURID, PA_SAM_TYPE_CRYPTOCARD,
+        PA_SAM_TYPE_APACHE
+    };
+
+    /** a list of all the sam type constants */
+    public static final List VALUES = Collections.unmodifiableList( Arrays.asList( values ) );
+
+    /** the name of the sam type */
+    private final String name;
+
+    /** the value/code for the sam type */
+    private final int ordinal;
+
+
+    /**
+     * Private constructor prevents construction outside of this class.
+     */
+    private SamType( int ordinal, String name )
+    {
+        this.ordinal = ordinal;
+        this.name    = name;
+    }
+
+
+    /**
+     * Returns the name of the SamType.
+     *
+     * @return the name of the SAM type
+     */
+    public String toString()
+    {
+		return name;
+	}
+
+
+    /**
+     * Compares this type to another object hopefully one that is of the same
+     * type.
+     *
+     * @param that the object to compare this SamType to
+     * @return ordinal - ( ( SamType ) that ).ordinal;
+     */
+	public int compareTo( Object that )
+    {
+		return ordinal - ( ( SamType ) 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 SamType getTypeByOrdinal( int ordinal )
+    {
+		for ( int ii = 0; ii < values.length; ii++ )
+        {
+			if ( values[ ii ].ordinal == ordinal )
+            {
+				return values[ ii ];
+            }
+        }
+
+		return PA_SAM_TYPE_APACHE;
+	}
+
+
+    /**
+     * Gets the ordinal value associated with this SAM type.
+     *
+     * @return the ordinal value associated with this SAM type
+     */
+	public int getOrdinal()
+    {
+		return ordinal;
+	}
+}
+

Modified: directory/protocol-providers/kerberos/trunk/core/src/java/org/apache/kerberos/sam/SamException.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/kerberos/trunk/core/src/java/org/apache/kerberos/sam/SamException.java?view=diff&r1=157874&r2=157875
==============================================================================
--- directory/protocol-providers/kerberos/trunk/core/src/java/org/apache/kerberos/sam/SamException.java (original)
+++ directory/protocol-providers/kerberos/trunk/core/src/java/org/apache/kerberos/sam/SamException.java Wed Mar 16 19:23:06 2005
@@ -16,6 +16,8 @@
  */
 package org.apache.kerberos.sam;
 
+import org.apache.kerberos.messages.value.SamType;
+
 
 /**
  * Base class for all SAM subsystem errors.

Modified: directory/protocol-providers/kerberos/trunk/core/src/java/org/apache/kerberos/sam/SamVerifier.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/kerberos/trunk/core/src/java/org/apache/kerberos/sam/SamVerifier.java?view=diff&r1=157874&r2=157875
==============================================================================
--- directory/protocol-providers/kerberos/trunk/core/src/java/org/apache/kerberos/sam/SamVerifier.java (original)
+++ directory/protocol-providers/kerberos/trunk/core/src/java/org/apache/kerberos/sam/SamVerifier.java Wed Mar 16 19:23:06 2005
@@ -20,6 +20,8 @@
 import javax.security.auth.kerberos.KerberosKey;
 import javax.security.auth.kerberos.KerberosPrincipal;
 
+import org.apache.kerberos.messages.value.SamType;
+
 
 /**
  * Single-use Authentication Mechanism verifier (subsystem) interface.

Modified: directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/store/LookupPrincipalActionImpl.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/store/LookupPrincipalActionImpl.java?view=diff&r1=157874&r2=157875
==============================================================================
--- directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/store/LookupPrincipalActionImpl.java (original)
+++ directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/store/LookupPrincipalActionImpl.java Wed Mar 16 19:23:06 2005
@@ -26,7 +26,7 @@
 import javax.security.auth.kerberos.KerberosPrincipal;
 
 import org.apache.kerberos.kdc.KerberosException;
-import org.apache.kerberos.sam.SamType;
+import org.apache.kerberos.messages.value.SamType;
 import org.apache.ldap.common.message.LockableAttributesImpl;
 
 /**

Modified: directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/store/PrincipalStoreEntry.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/store/PrincipalStoreEntry.java?view=diff&r1=157874&r2=157875
==============================================================================
--- directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/store/PrincipalStoreEntry.java (original)
+++ directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/store/PrincipalStoreEntry.java Wed Mar 16 19:23:06 2005
@@ -21,7 +21,7 @@
 import org.apache.kerberos.crypto.encryption.EncryptionType;
 import org.apache.kerberos.messages.value.EncryptionKey;
 import org.apache.kerberos.messages.value.KerberosTime;
-import org.apache.kerberos.sam.SamType;
+import org.apache.kerberos.messages.value.SamType;
 
 public class PrincipalStoreEntry {
 	

Modified: directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/store/PrincipalStoreEntryModifier.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/store/PrincipalStoreEntryModifier.java?view=diff&r1=157874&r2=157875
==============================================================================
--- directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/store/PrincipalStoreEntryModifier.java (original)
+++ directory/shared/kerberos/trunk/common/src/java/org/apache/kerberos/store/PrincipalStoreEntryModifier.java Wed Mar 16 19:23:06 2005
@@ -19,7 +19,7 @@
 import javax.security.auth.kerberos.KerberosPrincipal;
 
 import org.apache.kerberos.messages.value.KerberosTime;
-import org.apache.kerberos.sam.SamType;
+import org.apache.kerberos.messages.value.SamType;
 
 public class PrincipalStoreEntryModifier {