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 2004/10/19 20:48:31 UTC
svn commit: rev 55084 - in incubator/directory/kerberos/trunk/source/main/org/apache/kerberos: kdc messages/value
Author: erodriguez
Date: Tue Oct 19 11:48:31 2004
New Revision: 55084
Added:
incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/TransitedEncodingType.java
Modified:
incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/DefaultConfig.java
incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/TransitedEncoding.java
Log:
Clarification of TransitedEncoding type.
Modified: incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/DefaultConfig.java
==============================================================================
--- incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/DefaultConfig.java (original)
+++ incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/kdc/DefaultConfig.java Tue Oct 19 11:48:31 2004
@@ -71,9 +71,6 @@
public static final boolean DEFAULT_AP_EMPTY_ADDRESSES_ALLOWED = true;
// Protocol constants and associated values
- // Transited encoding type - Domain x500 compress
- public static final int DOMAIN_X500_COMPRESS = 1;
-
// Kerberos protocol version number
public static final int PVNO = 5;
// Authenticator version number
Modified: incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/TransitedEncoding.java
==============================================================================
--- incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/TransitedEncoding.java (original)
+++ incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/TransitedEncoding.java Tue Oct 19 11:48:31 2004
@@ -18,23 +18,23 @@
public class TransitedEncoding {
- private int _type;
- private byte[] _contents;
+ private TransitedEncodingType _type;
+ private byte[] _contents;
public TransitedEncoding() {
- _type = 0;
+ _type = TransitedEncodingType.NULL;
_contents = new byte[0];
}
- public TransitedEncoding(int type, byte[] contents) {
- _type = type;
+ public TransitedEncoding(TransitedEncodingType type, byte[] contents) {
+ _type = type;
_contents = contents;
}
public byte[] getContents() {
return _contents;
}
- public int getType() {
+ public TransitedEncodingType getType() {
return _type;
}
}
Added: incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/TransitedEncodingType.java
==============================================================================
--- (empty file)
+++ incubator/directory/kerberos/trunk/source/main/org/apache/kerberos/messages/value/TransitedEncodingType.java Tue Oct 19 11:48:31 2004
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2004 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.*;
+
+public final class TransitedEncodingType implements Comparable {
+
+ /**
+ * Enumeration elements are constructed once upon class loading.
+ * Order of appearance here determines the order of compareTo.
+ */
+ public static final TransitedEncodingType NULL = new TransitedEncodingType(0, "null");
+ public static final TransitedEncodingType DOMAIN_X500_COMPRESS = new TransitedEncodingType(1, "Domain X500 compress");
+
+ public String toString() {
+ return _fName + " (" + _fOrdinal + ")";
+ }
+
+ public int compareTo(Object that) {
+ return _fOrdinal - ((TransitedEncodingType) that)._fOrdinal;
+ }
+
+ public static TransitedEncodingType getTypeByOrdinal(int type) {
+ for (int i = 0; i < fValues.length; i++)
+ if (fValues[i]._fOrdinal == type)
+ return fValues[i];
+ return NULL;
+ }
+
+ public int getOrdinal() {
+ return _fOrdinal;
+ }
+
+ /// PRIVATE /////
+ private final String _fName;
+ private final int _fOrdinal;
+
+ /**
+ * Private constructor prevents construction outside of this class.
+ */
+ private TransitedEncodingType(int ordinal, String name) {
+ _fOrdinal = ordinal;
+ _fName = name;
+ }
+
+ /**
+ * These two lines are all that's necessary to export a List of VALUES.
+ */
+ private static final TransitedEncodingType[] fValues = {NULL, DOMAIN_X500_COMPRESS};
+ // VALUES needs to be located here, otherwise illegal forward reference
+ public static final List VALUES = Collections.unmodifiableList(Arrays.asList(fValues));
+}
+