directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1068124 [16/19] - in /directory/apacheds/branches/m1/kerberos-codec/src: main/java/org/apache/directory/server/kerberos/shared/crypto/checksum/ main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/ main/java/org/apache/d...
Date Mon, 07 Feb 2011 20:49:13 GMT
Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/KrbSafeBodyGrammar.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/KrbSafeBodyGrammar.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/KrbSafeBodyGrammar.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/KrbSafeBodyGrammar.java Mon Feb  7 20:49:04 2011
@@ -6,16 +6,16 @@
  *  to you 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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.kerberos.codec.krbSafeBody;
 
@@ -41,10 +41,10 @@ import org.slf4j.LoggerFactory;
  * This class implements the KRB-SAFE-BODY structure. All the actions are declared
  * in this class. As it is a singleton, these declaration are only done once. If
  * an action is to be added or modified, this is where the work is to be done !
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public final class KrbSafeBodyGrammar extends AbstractGrammar
+public final class KrbSafeBodyGrammar extends AbstractGrammar<KrbSafeBodyContainer>
 {
     /** The logger */
     static final Logger LOG = LoggerFactory.getLogger( KrbSafeBodyGrammar.class );
@@ -53,12 +53,13 @@ public final class KrbSafeBodyGrammar ex
     static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     /** The instance of grammar. KrbSafeBodyGrammar is a singleton */
-    private static Grammar instance = new KrbSafeBodyGrammar();
+    private static Grammar<KrbSafeBodyContainer> instance = new KrbSafeBodyGrammar();
 
 
     /**
      * Creates a new KrbSafeBodyGrammar object.
      */
+    @SuppressWarnings("unchecked")
     private KrbSafeBodyGrammar()
     {
         setName( KrbSafeBodyGrammar.class.getName() );
@@ -67,152 +68,193 @@ public final class KrbSafeBodyGrammar ex
         super.transitions = new GrammarTransition[KrbSafeBodyStatesEnum.LAST_KRB_SAFE_BODY_STATE.ordinal()][256];
 
         // ============================================================================================
-        // KrbSafeBody 
+        // KrbSafeBody
         // ============================================================================================
         // --------------------------------------------------------------------------------------------
         // Transition from KrbSafeBody init to KrbSafeBody seq
         // --------------------------------------------------------------------------------------------
         // KRB-SAFE-BODY   ::= SEQUENCE {
-        super.transitions[KrbSafeBodyStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            KrbSafeBodyStatesEnum.START_STATE, KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SEQ_TAG_STATE, UniversalTag.SEQUENCE.getValue(),
-            new KrbSafeBodyInit() );
-        
+        super.transitions[KrbSafeBodyStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+            new GrammarTransition<KrbSafeBodyContainer>(
+                KrbSafeBodyStatesEnum.START_STATE,
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SEQ_TAG_STATE,
+                UniversalTag.SEQUENCE.getValue(),
+                new KrbSafeBodyInit() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from KrbSafeBody seq to user-data tag
         // --------------------------------------------------------------------------------------------
         // KRB-SAFE-BODY   ::= SEQUENCE {
         // user-data       [0]
-        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SEQ_TAG_STATE.ordinal()][KerberosConstants.KRB_SAFE_BODY_USER_DATA_TAG] = new GrammarTransition(
-            KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SEQ_TAG_STATE, KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USER_DATA_TAG_STATE, KerberosConstants.KRB_SAFE_BODY_USER_DATA_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SEQ_TAG_STATE.ordinal()][KerberosConstants.KRB_SAFE_BODY_USER_DATA_TAG] =
+            new GrammarTransition<KrbSafeBodyContainer>(
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SEQ_TAG_STATE,
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USER_DATA_TAG_STATE, KerberosConstants.KRB_SAFE_BODY_USER_DATA_TAG,
+                new CheckNotNullLength<KrbSafeBodyContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from user-data tag to user-data value
         // --------------------------------------------------------------------------------------------
         // KRB-SAFE-BODY   ::= SEQUENCE {
         // user-data       [0] OCTET STRING
-        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USER_DATA_TAG_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
-            KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USER_DATA_TAG_STATE, KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USER_DATA_STATE, UniversalTag.OCTET_STRING.getValue(),
-            new StoreUserData() );
+        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USER_DATA_TAG_STATE.ordinal()][UniversalTag.OCTET_STRING
+            .getValue()] =
+            new GrammarTransition<KrbSafeBodyContainer>(
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USER_DATA_TAG_STATE,
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USER_DATA_STATE, UniversalTag.OCTET_STRING.getValue(),
+                new StoreUserData() );
 
         // --------------------------------------------------------------------------------------------
         // Transition from user-data value to timestamp tag
         // --------------------------------------------------------------------------------------------
         // KRB-SAFE-BODY   ::= SEQUENCE {
         // timestamp       [1]
-        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USER_DATA_STATE.ordinal()][KerberosConstants.KRB_SAFE_BODY_TIMESTAMP_TAG] = new GrammarTransition(
-            KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USER_DATA_STATE, KrbSafeBodyStatesEnum.KRB_SAFE_BODY_TIMESTAMP_TAG_STATE, KerberosConstants.KRB_SAFE_BODY_TIMESTAMP_TAG,
-            new CheckNotNullLength() );
+        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USER_DATA_STATE.ordinal()][KerberosConstants.KRB_SAFE_BODY_TIMESTAMP_TAG] =
+            new GrammarTransition<KrbSafeBodyContainer>(
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USER_DATA_STATE,
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_TIMESTAMP_TAG_STATE, KerberosConstants.KRB_SAFE_BODY_TIMESTAMP_TAG,
+                new CheckNotNullLength<KrbSafeBodyContainer>() );
 
         // --------------------------------------------------------------------------------------------
         // Transition from timestamp tag to timestamp value
         // --------------------------------------------------------------------------------------------
         // KRB-SAFE-BODY   ::= SEQUENCE {
         // timestamp       [1] KerberosTime OPTIONAL
-        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_TIMESTAMP_TAG_STATE.ordinal()][UniversalTag.GENERALIZED_TIME.getValue()] = new GrammarTransition(
-            KrbSafeBodyStatesEnum.KRB_SAFE_BODY_TIMESTAMP_TAG_STATE, KrbSafeBodyStatesEnum.KRB_SAFE_BODY_TIMESTAMP_STATE, UniversalTag.GENERALIZED_TIME.getValue(),
-            new StoreTimestamp() );
+        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_TIMESTAMP_TAG_STATE.ordinal()][UniversalTag.GENERALIZED_TIME
+            .getValue()] =
+            new GrammarTransition<KrbSafeBodyContainer>(
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_TIMESTAMP_TAG_STATE,
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_TIMESTAMP_STATE, UniversalTag.GENERALIZED_TIME.getValue(),
+                new StoreTimestamp() );
 
         // --------------------------------------------------------------------------------------------
         // Transition from timestamp value to usec tag
         // --------------------------------------------------------------------------------------------
         // KRB-SAFE-BODY   ::= SEQUENCE {
         // usec            [2]
-        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_TIMESTAMP_STATE.ordinal()][KerberosConstants.KRB_SAFE_BODY_USEC_TAG] = new GrammarTransition(
-            KrbSafeBodyStatesEnum.KRB_SAFE_BODY_TIMESTAMP_STATE, KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USEC_TAG_STATE, KerberosConstants.KRB_SAFE_BODY_USEC_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_TIMESTAMP_STATE.ordinal()][KerberosConstants.KRB_SAFE_BODY_USEC_TAG] =
+            new GrammarTransition<KrbSafeBodyContainer>(
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_TIMESTAMP_STATE,
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USEC_TAG_STATE, KerberosConstants.KRB_SAFE_BODY_USEC_TAG,
+                new CheckNotNullLength<KrbSafeBodyContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from usec tag to usec value
         // --------------------------------------------------------------------------------------------
         // KRB-SAFE-BODY   ::= SEQUENCE {
         // usec            [2] Microseconds OPTIONAL
-        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USEC_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = new GrammarTransition(
-            KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USEC_TAG_STATE, KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USEC_STATE, UniversalTag.INTEGER.getValue(),
-            new StoreUsec() );
+        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USEC_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] =
+            new GrammarTransition<KrbSafeBodyContainer>(
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USEC_TAG_STATE,
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USEC_STATE,
+                UniversalTag.INTEGER.getValue(),
+                new StoreUsec() );
 
         // --------------------------------------------------------------------------------------------
         // Transition from usec value to seq-number tag
         // --------------------------------------------------------------------------------------------
         // KRB-SAFE-BODY   ::= SEQUENCE {
         // seq-number      [3]
-        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USEC_STATE.ordinal()][KerberosConstants.KRB_SAFE_BODY_SEQ_NUMBER_TAG] = new GrammarTransition(
-            KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USEC_STATE, KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SEQ_NUMBER_TAG_STATE, KerberosConstants.KRB_SAFE_BODY_SEQ_NUMBER_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USEC_STATE.ordinal()][KerberosConstants.KRB_SAFE_BODY_SEQ_NUMBER_TAG] =
+            new GrammarTransition<KrbSafeBodyContainer>(
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USEC_STATE,
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SEQ_NUMBER_TAG_STATE,
+                KerberosConstants.KRB_SAFE_BODY_SEQ_NUMBER_TAG,
+                new CheckNotNullLength<KrbSafeBodyContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from seq-number tag to seq-number value
         // --------------------------------------------------------------------------------------------
         // KRB-SAFE-BODY   ::= SEQUENCE {
         // seq-number      [3] UInt32 OPTIONAL
-        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SEQ_NUMBER_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = new GrammarTransition(
-            KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SEQ_NUMBER_TAG_STATE, KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SEQ_NUMBER_STATE, UniversalTag.INTEGER.getValue(),
-            new StoreSeqNumber() );
-        
+        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SEQ_NUMBER_TAG_STATE.ordinal()][UniversalTag.INTEGER
+            .getValue()] =
+            new GrammarTransition<KrbSafeBodyContainer>(
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SEQ_NUMBER_TAG_STATE,
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SEQ_NUMBER_STATE, UniversalTag.INTEGER.getValue(),
+                new StoreSeqNumber() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from seq-number to s-address tag
         // --------------------------------------------------------------------------------------------
         // KRB-SAFE-BODY   ::= SEQUENCE {
         // s-address       [4] HostAddress
-        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SEQ_NUMBER_STATE.ordinal()][KerberosConstants.KRB_SAFE_BODY_SENDER_ADDRESS_TAG] = new GrammarTransition(
-            KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SEQ_NUMBER_STATE, KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SENDER_ADDRESS_TAG_STATE, KerberosConstants.KRB_SAFE_BODY_SENDER_ADDRESS_TAG,
-            new StoreSenderAddress() );
+        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SEQ_NUMBER_STATE.ordinal()][KerberosConstants.KRB_SAFE_BODY_SENDER_ADDRESS_TAG] =
+            new GrammarTransition<KrbSafeBodyContainer>(
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SEQ_NUMBER_STATE,
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SENDER_ADDRESS_TAG_STATE,
+                KerberosConstants.KRB_SAFE_BODY_SENDER_ADDRESS_TAG,
+                new StoreSenderAddress() );
 
         // --------------------------------------------------------------------------------------------
         // Transition from s-address tag to r-address tag
         // --------------------------------------------------------------------------------------------
         // KRB-SAFE-BODY   ::= SEQUENCE {
         // r-address       [5] HostAddress
-        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SENDER_ADDRESS_TAG_STATE.ordinal()][KerberosConstants.KRB_SAFE_BODY_RECIPIENT_ADDRESS_TAG] = new GrammarTransition(
-            KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SENDER_ADDRESS_TAG_STATE, KrbSafeBodyStatesEnum.KRB_SAFE_BODY_RECIPIENT_ADDRESS_TAG_STATE, KerberosConstants.KRB_SAFE_BODY_RECIPIENT_ADDRESS_TAG,
-            new StoreRecipientAddress() );
-        
+        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SENDER_ADDRESS_TAG_STATE.ordinal()][KerberosConstants.KRB_SAFE_BODY_RECIPIENT_ADDRESS_TAG] =
+            new GrammarTransition<KrbSafeBodyContainer>(
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SENDER_ADDRESS_TAG_STATE,
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_RECIPIENT_ADDRESS_TAG_STATE,
+                KerberosConstants.KRB_SAFE_BODY_RECIPIENT_ADDRESS_TAG,
+                new StoreRecipientAddress() );
+
         //----------------------------- OPTIONAL transitions ---------------------------
-        
+
         // --------------------------------------------------------------------------------------------
         // Transition from user-data value to usec tag
         // --------------------------------------------------------------------------------------------
         // KRB-SAFE-BODY   ::= SEQUENCE {
         // usec       [2]
-        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USER_DATA_STATE.ordinal()][KerberosConstants.KRB_SAFE_BODY_USEC_TAG] = new GrammarTransition(
-            KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USER_DATA_STATE, KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USEC_TAG_STATE, KerberosConstants.KRB_SAFE_BODY_USEC_TAG,
-            new CheckNotNullLength() );
+        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USER_DATA_STATE.ordinal()][KerberosConstants.KRB_SAFE_BODY_USEC_TAG] =
+            new GrammarTransition<KrbSafeBodyContainer>(
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USER_DATA_STATE,
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USEC_TAG_STATE, KerberosConstants.KRB_SAFE_BODY_USEC_TAG,
+                new CheckNotNullLength<KrbSafeBodyContainer>() );
 
         // --------------------------------------------------------------------------------------------
         // Transition from user-data value to seq-number tag
         // --------------------------------------------------------------------------------------------
         // KRB-SAFE-BODY   ::= SEQUENCE {
         // seq-number       [3]
-        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USER_DATA_STATE.ordinal()][KerberosConstants.KRB_SAFE_BODY_SEQ_NUMBER_TAG] = new GrammarTransition(
-            KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USER_DATA_STATE, KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SEQ_NUMBER_TAG_STATE, KerberosConstants.KRB_SAFE_BODY_SEQ_NUMBER_TAG,
-            new CheckNotNullLength() );
+        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USER_DATA_STATE.ordinal()][KerberosConstants.KRB_SAFE_BODY_SEQ_NUMBER_TAG] =
+            new GrammarTransition<KrbSafeBodyContainer>(
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USER_DATA_STATE,
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SEQ_NUMBER_TAG_STATE,
+                KerberosConstants.KRB_SAFE_BODY_SEQ_NUMBER_TAG,
+                new CheckNotNullLength<KrbSafeBodyContainer>() );
 
         // --------------------------------------------------------------------------------------------
         // Transition from user-data value to s-address tag
         // --------------------------------------------------------------------------------------------
         // KRB-SAFE-BODY   ::= SEQUENCE {
         // s-address       [4]
-        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USER_DATA_STATE.ordinal()][KerberosConstants.KRB_SAFE_BODY_SENDER_ADDRESS_TAG] = new GrammarTransition(
-            KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USER_DATA_STATE, KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SENDER_ADDRESS_TAG_STATE, KerberosConstants.KRB_SAFE_BODY_SENDER_ADDRESS_TAG,
-            new StoreSenderAddress() );
+        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USER_DATA_STATE.ordinal()][KerberosConstants.KRB_SAFE_BODY_SENDER_ADDRESS_TAG] =
+            new GrammarTransition<KrbSafeBodyContainer>(
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USER_DATA_STATE,
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SENDER_ADDRESS_TAG_STATE,
+                KerberosConstants.KRB_SAFE_BODY_SENDER_ADDRESS_TAG,
+                new StoreSenderAddress() );
 
         // --------------------------------------------------------------------------------------------
         // Transition from usec value to s-address tag
         // --------------------------------------------------------------------------------------------
         // KRB-SAFE-BODY   ::= SEQUENCE {
         // s-address       [4]
-        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USEC_STATE.ordinal()][KerberosConstants.KRB_SAFE_BODY_SENDER_ADDRESS_TAG] = new GrammarTransition(
-            KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USEC_STATE, KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SENDER_ADDRESS_TAG_STATE, KerberosConstants.KRB_SAFE_BODY_SENDER_ADDRESS_TAG,
-            new StoreSenderAddress() );
+        super.transitions[KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USEC_STATE.ordinal()][KerberosConstants.KRB_SAFE_BODY_SENDER_ADDRESS_TAG] =
+            new GrammarTransition<KrbSafeBodyContainer>(
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_USEC_STATE,
+                KrbSafeBodyStatesEnum.KRB_SAFE_BODY_SENDER_ADDRESS_TAG_STATE,
+                KerberosConstants.KRB_SAFE_BODY_SENDER_ADDRESS_TAG,
+                new StoreSenderAddress() );
     }
 
 
     /**
      * Get the instance of this grammar
-     * 
+     *
      * @return An instance on the KRB-SAFE-BODY Grammar
      */
-    public static Grammar getInstance()
+    public static Grammar<KrbSafeBodyContainer> getInstance()
     {
         return instance;
     }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/KrbSafeBodyStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/KrbSafeBodyStatesEnum.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/KrbSafeBodyStatesEnum.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/KrbSafeBodyStatesEnum.java Mon Feb  7 20:49:04 2011
@@ -6,16 +6,16 @@
  *  to you 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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.kerberos.codec.krbSafeBody;
 
@@ -27,40 +27,40 @@ import org.apache.directory.shared.asn1.
 /**
  * This class stores the KRB-SAFE-BODY grammar's constants. It is also used for debugging
  * purpose
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public enum KrbSafeBodyStatesEnum implements States
 {
     // Start
     START_STATE,                                // 0
-    
+
     // ----- KRB-ERROR component --------------------------------------
     KRB_SAFE_BODY_SEQ_TAG_STATE,                // 1
-    
+
     KRB_SAFE_BODY_USER_DATA_TAG_STATE,          // 2
     KRB_SAFE_BODY_USER_DATA_STATE,              // 3
-    
+
     KRB_SAFE_BODY_TIMESTAMP_TAG_STATE,          // 4
     KRB_SAFE_BODY_TIMESTAMP_STATE,              // 5
-    
+
     KRB_SAFE_BODY_USEC_TAG_STATE,               // 6
     KRB_SAFE_BODY_USEC_STATE,                   // 7
-    
+
     KRB_SAFE_BODY_SEQ_NUMBER_TAG_STATE,         // 8
     KRB_SAFE_BODY_SEQ_NUMBER_STATE,             // 9
-    
+
     KRB_SAFE_BODY_SENDER_ADDRESS_TAG_STATE,     // 10
-    
+
     KRB_SAFE_BODY_RECIPIENT_ADDRESS_TAG_STATE,  // 11
 
     // End
     LAST_KRB_SAFE_BODY_STATE;                   // 12
 
-    
+
     /**
      * Get the grammar name
-     * 
+     *
      * @param grammar The grammar code
      * @return The grammar name
      */
@@ -72,11 +72,11 @@ public enum KrbSafeBodyStatesEnum implem
 
     /**
      * Get the grammar name
-     * 
+     *
      * @param grammar The grammar class
      * @return The grammar name
      */
-    public String getGrammarName( Grammar grammar )
+    public String getGrammarName( Grammar<KrbSafeBodyContainer> grammar )
     {
         if ( grammar instanceof KrbSafeBodyGrammar )
         {
@@ -91,7 +91,7 @@ public enum KrbSafeBodyStatesEnum implem
 
     /**
      * Get the string representing the state
-     * 
+     *
      * @param state The state number
      * @return The String representing the state
      */
@@ -100,7 +100,7 @@ public enum KrbSafeBodyStatesEnum implem
         return ( ( state == LAST_KRB_SAFE_BODY_STATE.ordinal() ) ? "LAST_KRB_SAFE_BODY_STATE" : name() );
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
@@ -108,8 +108,8 @@ public enum KrbSafeBodyStatesEnum implem
     {
         return this == LAST_KRB_SAFE_BODY_STATE;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/KrbSafeBodyInit.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/KrbSafeBodyInit.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/KrbSafeBodyInit.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/KrbSafeBodyInit.java Mon Feb  7 20:49:04 2011
@@ -6,22 +6,21 @@
  *  to you 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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.kerberos.codec.krbSafeBody.actions;
 
 
 import org.apache.directory.shared.asn1.DecoderException;
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.i18n.I18n;
@@ -33,10 +32,10 @@ import org.slf4j.LoggerFactory;
 
 /**
  * The action used to initialize the KrbSafeBody object
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class KrbSafeBodyInit extends GrammarAction
+public class KrbSafeBodyInit extends GrammarAction<KrbSafeBodyContainer>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( KrbSafeBodyInit.class );
@@ -57,10 +56,8 @@ public class KrbSafeBodyInit extends Gra
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    public void action( KrbSafeBodyContainer krbSafeBodyContainer ) throws DecoderException
     {
-        KrbSafeBodyContainer krbSafeBodyContainer = ( KrbSafeBodyContainer ) container;
-
         TLV tlv = krbSafeBodyContainer.getCurrentTLV();
 
         // The Length should not be null
@@ -71,10 +68,10 @@ public class KrbSafeBodyInit extends Gra
             // This will generate a PROTOCOL_ERROR
             throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
         }
-        
+
         KrbSafeBody krbSafeBody = new KrbSafeBody();
         krbSafeBodyContainer.setKrbSafeBody( krbSafeBody );
-        
+
         if ( IS_DEBUG )
         {
             LOG.debug( "KrbSafeBody created" );

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/StoreRecipientAddress.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/StoreRecipientAddress.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/StoreRecipientAddress.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/StoreRecipientAddress.java Mon Feb  7 20:49:04 2011
@@ -21,7 +21,6 @@
 package org.apache.directory.shared.kerberos.codec.krbSafeBody.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.kerberos.codec.actions.AbstractReadHostAddress;
 import org.apache.directory.shared.kerberos.codec.krbSafeBody.KrbSafeBodyContainer;
 import org.apache.directory.shared.kerberos.components.HostAddress;
@@ -32,7 +31,7 @@ import org.apache.directory.shared.kerbe
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreRecipientAddress extends AbstractReadHostAddress
+public class StoreRecipientAddress extends AbstractReadHostAddress<KrbSafeBodyContainer>
 {
     public StoreRecipientAddress()
     {
@@ -44,11 +43,10 @@ public class StoreRecipientAddress exten
      * {@inheritDoc}
      */
     @Override
-    protected void setAddress( HostAddress hostAddress, Asn1Container container )
+    protected void setAddress( HostAddress hostAddress, KrbSafeBodyContainer krbSafeBodyContainer )
     {
-        KrbSafeBodyContainer krbSafeBodyContainer = ( KrbSafeBodyContainer ) container;
         krbSafeBodyContainer.getKrbSafeBody().setRecipientAddress( hostAddress );
-        
-        container.setGrammarEndAllowed( true );
+
+        krbSafeBodyContainer.setGrammarEndAllowed( true );
     }
 }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/StoreSenderAddress.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/StoreSenderAddress.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/StoreSenderAddress.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/StoreSenderAddress.java Mon Feb  7 20:49:04 2011
@@ -21,7 +21,6 @@
 package org.apache.directory.shared.kerberos.codec.krbSafeBody.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.kerberos.codec.actions.AbstractReadHostAddress;
 import org.apache.directory.shared.kerberos.codec.krbSafeBody.KrbSafeBodyContainer;
 import org.apache.directory.shared.kerberos.components.HostAddress;
@@ -32,7 +31,7 @@ import org.apache.directory.shared.kerbe
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreSenderAddress extends AbstractReadHostAddress
+public class StoreSenderAddress extends AbstractReadHostAddress<KrbSafeBodyContainer>
 {
     public StoreSenderAddress()
     {
@@ -44,11 +43,10 @@ public class StoreSenderAddress extends 
      * {@inheritDoc}
      */
     @Override
-    protected void setAddress( HostAddress hostAddress, Asn1Container container )
+    protected void setAddress( HostAddress hostAddress, KrbSafeBodyContainer krbSafeBodyContainer )
     {
-        KrbSafeBodyContainer krbSafeBodyContainer = ( KrbSafeBodyContainer ) container;
         krbSafeBodyContainer.getKrbSafeBody().setSenderAddress( hostAddress );
-        
-        container.setGrammarEndAllowed( true );
+
+        krbSafeBodyContainer.setGrammarEndAllowed( true );
     }
 }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/StoreSeqNumber.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/StoreSeqNumber.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/StoreSeqNumber.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/StoreSeqNumber.java Mon Feb  7 20:49:04 2011
@@ -6,31 +6,30 @@
  *  to you 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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.kerberos.codec.krbSafeBody.actions;
 
 
 import org.apache.directory.shared.asn1.actions.AbstractReadInteger;
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.kerberos.codec.krbSafeBody.KrbSafeBodyContainer;
 
 
 /**
  * The action used to store the KrbSafeBody seq-number
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreSeqNumber extends AbstractReadInteger
+public class StoreSeqNumber extends AbstractReadInteger<KrbSafeBodyContainer>
 {
 
     /**
@@ -46,9 +45,8 @@ public class StoreSeqNumber extends Abst
      * {@inheritDoc}
      */
     @Override
-    protected void setIntegerValue( int value, Asn1Container container )
+    protected void setIntegerValue( int value, KrbSafeBodyContainer krbSafeBodyContainer )
     {
-        KrbSafeBodyContainer krbSafeBodyContainer = ( KrbSafeBodyContainer ) container;
         krbSafeBodyContainer.getKrbSafeBody().setSeqNumber( value );
     }
 }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/StoreTimestamp.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/StoreTimestamp.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/StoreTimestamp.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/StoreTimestamp.java Mon Feb  7 20:49:04 2011
@@ -6,21 +6,20 @@
  *  to you 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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.kerberos.codec.krbSafeBody.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.kerberos.KerberosTime;
 import org.apache.directory.shared.kerberos.codec.actions.AbstractReadKerberosTime;
 import org.apache.directory.shared.kerberos.codec.krbSafeBody.KrbSafeBodyContainer;
@@ -28,10 +27,10 @@ import org.apache.directory.shared.kerbe
 
 /**
  * The action used to store the KrbSafeBody timemstamp
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreTimestamp extends AbstractReadKerberosTime
+public class StoreTimestamp extends AbstractReadKerberosTime<KrbSafeBodyContainer>
 {
 
     /**
@@ -47,9 +46,8 @@ public class StoreTimestamp extends Abst
      * {@inheritDoc}
      */
     @Override
-    protected void setKerberosTime( KerberosTime krbtime, Asn1Container container )
+    protected void setKerberosTime( KerberosTime krbtime, KrbSafeBodyContainer krbSafeBodyContainer )
     {
-        KrbSafeBodyContainer krbSafeBodyContainer = ( KrbSafeBodyContainer ) container;
         krbSafeBodyContainer.getKrbSafeBody().setTimestamp( krbtime );
     }
 }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/StoreUsec.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/StoreUsec.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/StoreUsec.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/StoreUsec.java Mon Feb  7 20:49:04 2011
@@ -6,31 +6,30 @@
  *  to you 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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.kerberos.codec.krbSafeBody.actions;
 
 
 import org.apache.directory.shared.asn1.actions.AbstractReadInteger;
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.kerberos.codec.krbSafeBody.KrbSafeBodyContainer;
 
 
 /**
  * The action used to store the KrbSafeBody usec
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreUsec extends AbstractReadInteger
+public class StoreUsec extends AbstractReadInteger<KrbSafeBodyContainer>
 {
 
     /**
@@ -46,10 +45,8 @@ public class StoreUsec extends AbstractR
      * {@inheritDoc}
      */
     @Override
-    protected void setIntegerValue( int value, Asn1Container container )
+    protected void setIntegerValue( int value, KrbSafeBodyContainer krbSafeBodyContainer )
     {
-        KrbSafeBodyContainer krbSafeBodyContainer = ( KrbSafeBodyContainer ) container;
         krbSafeBodyContainer.getKrbSafeBody().setUsec( value );
     }
-
 }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/StoreUserData.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/StoreUserData.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/StoreUserData.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafeBody/actions/StoreUserData.java Mon Feb  7 20:49:04 2011
@@ -6,31 +6,30 @@
  *  to you 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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.kerberos.codec.krbSafeBody.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.asn1.actions.AbstractReadOctetString;
 import org.apache.directory.shared.kerberos.codec.krbSafeBody.KrbSafeBodyContainer;
 
 
 /**
  * The action used to read the KrbSafeBody user-data
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreUserData extends AbstractReadOctetString
+public class StoreUserData extends AbstractReadOctetString<KrbSafeBodyContainer>
 {
     /**
      * Instantiates a new StoreUserData action.
@@ -45,9 +44,8 @@ public class StoreUserData extends Abstr
      * {@inheritDoc}
      */
     @Override
-    protected void setOctetString( byte[] data, Asn1Container container )
+    protected void setOctetString( byte[] data, KrbSafeBodyContainer krbSafeBodyContainer )
     {
-        KrbSafeBodyContainer krbSafeBodyContainer = ( KrbSafeBodyContainer ) container;
         krbSafeBodyContainer.getKrbSafeBody().setUserData( data );
     }
 }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/lastReq/LastReqGrammar.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/lastReq/LastReqGrammar.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/lastReq/LastReqGrammar.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/lastReq/LastReqGrammar.java Mon Feb  7 20:49:04 2011
@@ -6,16 +6,16 @@
  *  to you 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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.kerberos.codec.lastReq;
 
@@ -37,10 +37,10 @@ import org.slf4j.LoggerFactory;
  * This class implements the LastReq structure. All the actions are declared
  * in this class. As it is a singleton, these declaration are only done once. If
  * an action is to be added or modified, this is where the work is to be done !
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public final class LastReqGrammar extends AbstractGrammar
+public final class LastReqGrammar extends AbstractGrammar<LastReqContainer>
 {
     /** The logger */
     static final Logger LOG = LoggerFactory.getLogger( LastReqGrammar.class );
@@ -49,12 +49,13 @@ public final class LastReqGrammar extend
     static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     /** The instance of grammar. LastReqGrammar is a singleton */
-    private static Grammar instance = new LastReqGrammar();
+    private static Grammar<LastReqContainer> instance = new LastReqGrammar();
 
 
     /**
      * Creates a new LastReqGrammar object.
      */
+    @SuppressWarnings("unchecked")
     private LastReqGrammar()
     {
         setName( LastReqGrammar.class.getName() );
@@ -63,62 +64,81 @@ public final class LastReqGrammar extend
         super.transitions = new GrammarTransition[LastReqStatesEnum.LAST_LAST_REQ_STATE.ordinal()][256];
 
         // ============================================================================================
-        // LastReq 
+        // LastReq
         // ============================================================================================
         // --------------------------------------------------------------------------------------------
         // Transition from LastReq init to LastReq SEQ OF
         // --------------------------------------------------------------------------------------------
         // LastReq   ::= SEQUENCE OF
-        super.transitions[LastReqStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            LastReqStatesEnum.START_STATE, LastReqStatesEnum.LAST_REQ_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
-            new LastReqInit() );
-        
+        super.transitions[LastReqStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+            new GrammarTransition<LastReqContainer>(
+                LastReqStatesEnum.START_STATE,
+                LastReqStatesEnum.LAST_REQ_SEQ_STATE,
+                UniversalTag.SEQUENCE.getValue(),
+                new LastReqInit() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from LastReq SEQ OF to LastReq SEQ OF SEQ
         // --------------------------------------------------------------------------------------------
         // LastReq   ::= SEQUENCE OF SEQUENCE {
-        super.transitions[LastReqStatesEnum.LAST_REQ_SEQ_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            LastReqStatesEnum.LAST_REQ_SEQ_STATE, LastReqStatesEnum.LAST_REQ_SEQ_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
-            new CheckNotNullLength() );
-        
+        super.transitions[LastReqStatesEnum.LAST_REQ_SEQ_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+            new GrammarTransition<LastReqContainer>(
+                LastReqStatesEnum.LAST_REQ_SEQ_STATE,
+                LastReqStatesEnum.LAST_REQ_SEQ_SEQ_STATE,
+                UniversalTag.SEQUENCE.getValue(),
+                new CheckNotNullLength<LastReqContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from LastReq SEQ OF SEQ to lr-type tag
         // --------------------------------------------------------------------------------------------
         // LastReq   ::= SEQUENCE OF SEQUENCE {
         //         lr-type         [0]
-        super.transitions[LastReqStatesEnum.LAST_REQ_SEQ_SEQ_STATE.ordinal()][KerberosConstants.LAST_REQ_LR_TYPE_TAG] = new GrammarTransition(
-            LastReqStatesEnum.LAST_REQ_SEQ_SEQ_STATE, LastReqStatesEnum.LAST_REQ_LR_TYPE_TAG_STATE, KerberosConstants.LAST_REQ_LR_TYPE_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[LastReqStatesEnum.LAST_REQ_SEQ_SEQ_STATE.ordinal()][KerberosConstants.LAST_REQ_LR_TYPE_TAG] =
+            new GrammarTransition<LastReqContainer>(
+                LastReqStatesEnum.LAST_REQ_SEQ_SEQ_STATE,
+                LastReqStatesEnum.LAST_REQ_LR_TYPE_TAG_STATE,
+                KerberosConstants.LAST_REQ_LR_TYPE_TAG,
+                new CheckNotNullLength<LastReqContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from lr-type tag to lr-type value
         // --------------------------------------------------------------------------------------------
         // LastReq   ::= SEQUENCE OF SEQUENCE {
         //         lr-type         [0]  Int32,
-        super.transitions[LastReqStatesEnum.LAST_REQ_LR_TYPE_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = new GrammarTransition(
-            LastReqStatesEnum.LAST_REQ_LR_TYPE_TAG_STATE, LastReqStatesEnum.LAST_REQ_LR_TYPE_STATE, UniversalTag.INTEGER.getValue(),
-            new StoreLrType() );
-        
+        super.transitions[LastReqStatesEnum.LAST_REQ_LR_TYPE_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] =
+            new GrammarTransition<LastReqContainer>(
+                LastReqStatesEnum.LAST_REQ_LR_TYPE_TAG_STATE,
+                LastReqStatesEnum.LAST_REQ_LR_TYPE_STATE,
+                UniversalTag.INTEGER.getValue(),
+                new StoreLrType() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from lr-type value lr-value tag
         // --------------------------------------------------------------------------------------------
         // LastReq   ::= SEQUENCE OF SEQUENCE {
         //         ...
         //         lr-value        [1]
-        super.transitions[LastReqStatesEnum.LAST_REQ_LR_TYPE_STATE.ordinal()][KerberosConstants.LAST_REQ_LR_VALUE_TAG] = new GrammarTransition(
-            LastReqStatesEnum.LAST_REQ_LR_TYPE_STATE, LastReqStatesEnum.LAST_REQ_LR_VALUE_TAG_STATE, KerberosConstants.LAST_REQ_LR_VALUE_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[LastReqStatesEnum.LAST_REQ_LR_TYPE_STATE.ordinal()][KerberosConstants.LAST_REQ_LR_VALUE_TAG] =
+            new GrammarTransition<LastReqContainer>(
+                LastReqStatesEnum.LAST_REQ_LR_TYPE_STATE,
+                LastReqStatesEnum.LAST_REQ_LR_VALUE_TAG_STATE,
+                KerberosConstants.LAST_REQ_LR_VALUE_TAG,
+                new CheckNotNullLength<LastReqContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from lr-value tag to lr-value value
         // --------------------------------------------------------------------------------------------
         // LastReq   ::= SEQUENCE OF SEQUENCE {
         //         ...
         //         lr-value        [1] KerberosTime
-        super.transitions[LastReqStatesEnum.LAST_REQ_LR_VALUE_TAG_STATE.ordinal()][UniversalTag.GENERALIZED_TIME.getValue()] = new GrammarTransition(
-            LastReqStatesEnum.LAST_REQ_LR_VALUE_TAG_STATE, LastReqStatesEnum.LAST_REQ_LR_VALUE_STATE, UniversalTag.GENERALIZED_TIME.getValue(),
-            new StoreLrValue() );
-        
+        super.transitions[LastReqStatesEnum.LAST_REQ_LR_VALUE_TAG_STATE.ordinal()][UniversalTag.GENERALIZED_TIME
+            .getValue()] =
+            new GrammarTransition<LastReqContainer>(
+                LastReqStatesEnum.LAST_REQ_LR_VALUE_TAG_STATE,
+                LastReqStatesEnum.LAST_REQ_LR_VALUE_STATE,
+                UniversalTag.GENERALIZED_TIME.getValue(),
+                new StoreLrValue() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from lr-value value to SEQ OF SEQ
         // --------------------------------------------------------------------------------------------
@@ -126,18 +146,21 @@ public final class LastReqGrammar extend
         //         ...
         //         lr-value        [1] KerberosTime
         // }
-        super.transitions[LastReqStatesEnum.LAST_REQ_LR_VALUE_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            LastReqStatesEnum.LAST_REQ_LR_VALUE_STATE, LastReqStatesEnum.LAST_REQ_SEQ_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
-            new CheckNotNullLength() );
+        super.transitions[LastReqStatesEnum.LAST_REQ_LR_VALUE_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+            new GrammarTransition<LastReqContainer>(
+                LastReqStatesEnum.LAST_REQ_LR_VALUE_STATE,
+                LastReqStatesEnum.LAST_REQ_SEQ_SEQ_STATE,
+                UniversalTag.SEQUENCE.getValue(),
+                new CheckNotNullLength<LastReqContainer>() );
     }
 
 
     /**
      * Get the instance of this grammar
-     * 
+     *
      * @return An instance on the LastReq Grammar
      */
-    public static Grammar getInstance()
+    public static Grammar<LastReqContainer> getInstance()
     {
         return instance;
     }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/lastReq/LastReqStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/lastReq/LastReqStatesEnum.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/lastReq/LastReqStatesEnum.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/lastReq/LastReqStatesEnum.java Mon Feb  7 20:49:04 2011
@@ -6,16 +6,16 @@
  *  to you 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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.kerberos.codec.lastReq;
 
@@ -27,31 +27,31 @@ import org.apache.directory.shared.asn1.
 /**
  * This class store the LastRequest grammar's constants. It is also used for debugging
  * purpose
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public enum LastReqStatesEnum implements States
 {
     // Start
     START_STATE,                      // 0
-    
+
     LAST_REQ_SEQ_STATE,               // 1
-    
+
     LAST_REQ_SEQ_SEQ_STATE,           // 2
-    
+
     LAST_REQ_LR_TYPE_TAG_STATE,       // 3
     LAST_REQ_LR_TYPE_STATE,           // 4
-    
+
     LAST_REQ_LR_VALUE_TAG_STATE,      // 5
     LAST_REQ_LR_VALUE_STATE,          // 6
-    
+
     // End
     LAST_LAST_REQ_STATE;              // 7
 
-    
+
     /**
      * Get the grammar name
-     * 
+     *
      * @param grammar The grammar code
      * @return The grammar name
      */
@@ -63,11 +63,11 @@ public enum LastReqStatesEnum implements
 
     /**
      * Get the grammar name
-     * 
+     *
      * @param grammar The grammar class
      * @return The grammar name
      */
-    public String getGrammarName( Grammar grammar )
+    public String getGrammarName( Grammar<LastReqContainer> grammar )
     {
         if ( grammar instanceof LastReqGrammar )
         {
@@ -82,7 +82,7 @@ public enum LastReqStatesEnum implements
 
     /**
      * Get the string representing the state
-     * 
+     *
      * @param state The state number
      * @return The String representing the state
      */
@@ -91,7 +91,7 @@ public enum LastReqStatesEnum implements
         return ( ( state == LAST_LAST_REQ_STATE.ordinal() ) ? "LAST_LAST_REQ_STATE" : name() );
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
@@ -99,8 +99,8 @@ public enum LastReqStatesEnum implements
     {
         return this == LAST_LAST_REQ_STATE;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/lastReq/actions/LastReqInit.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/lastReq/actions/LastReqInit.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/lastReq/actions/LastReqInit.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/lastReq/actions/LastReqInit.java Mon Feb  7 20:49:04 2011
@@ -6,24 +6,23 @@
  *  to you 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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.kerberos.codec.lastReq.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
+import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
-import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.kerberos.codec.lastReq.LastReqContainer;
 import org.apache.directory.shared.kerberos.components.LastReq;
@@ -33,10 +32,10 @@ import org.slf4j.LoggerFactory;
 
 /**
  * The action used to initialize the LastReq object
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class LastReqInit extends GrammarAction
+public class LastReqInit extends GrammarAction<LastReqContainer>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( LastReqInit.class );
@@ -57,10 +56,8 @@ public class LastReqInit extends Grammar
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    public void action( LastReqContainer lastReqContainer ) throws DecoderException
     {
-        LastReqContainer lastReqContainer = ( LastReqContainer ) container;
-
         TLV tlv = lastReqContainer.getCurrentTLV();
 
         // The Length should not be null
@@ -71,10 +68,10 @@ public class LastReqInit extends Grammar
             // This will generate a PROTOCOL_ERROR
             throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
         }
-        
+
         LastReq lastReq = new LastReq();
         lastReqContainer.setLastReq( lastReq );
-        
+
         if ( IS_DEBUG )
         {
             LOG.debug( "LastReq created" );

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/lastReq/actions/StoreLrType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/lastReq/actions/StoreLrType.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/lastReq/actions/StoreLrType.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/lastReq/actions/StoreLrType.java Mon Feb  7 20:49:04 2011
@@ -6,22 +6,21 @@
  *  to you 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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.kerberos.codec.lastReq.actions;
 
 
 import org.apache.directory.shared.asn1.actions.AbstractReadInteger;
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.kerberos.codec.lastReq.LastReqContainer;
 import org.apache.directory.shared.kerberos.codec.types.LastReqType;
 import org.apache.directory.shared.kerberos.components.LastReq;
@@ -29,10 +28,10 @@ import org.apache.directory.shared.kerbe
 
 /**
  * The action used to store the LastReq lrType
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreLrType extends AbstractReadInteger
+public class StoreLrType extends AbstractReadInteger<LastReqContainer>
 {
     /**
      * Instantiates a new LastReqLrType action.
@@ -47,12 +46,10 @@ public class StoreLrType extends Abstrac
      * {@inheritDoc}
      */
     @Override
-    protected void setIntegerValue( int value, Asn1Container container )
+    protected void setIntegerValue( int value, LastReqContainer lastReqContainer )
     {
-        LastReqContainer lastReqContainer = ( LastReqContainer ) container;
-        
         LastReqType lrType = LastReqType.getTypeByValue( value );
-        
+
         LastReq lastReq = lastReqContainer.getLastReq();
         lastReq.createNewLR();
         lastReq.setCurrentLrType( lrType );

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/lastReq/actions/StoreLrValue.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/lastReq/actions/StoreLrValue.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/lastReq/actions/StoreLrValue.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/lastReq/actions/StoreLrValue.java Mon Feb  7 20:49:04 2011
@@ -6,21 +6,20 @@
  *  to you 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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.kerberos.codec.lastReq.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.kerberos.KerberosTime;
 import org.apache.directory.shared.kerberos.codec.actions.AbstractReadKerberosTime;
 import org.apache.directory.shared.kerberos.codec.lastReq.LastReqContainer;
@@ -28,10 +27,10 @@ import org.apache.directory.shared.kerbe
 
 /**
  * The action used to store the LastReq value
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreLrValue extends AbstractReadKerberosTime
+public class StoreLrValue extends AbstractReadKerberosTime<LastReqContainer>
 {
 
     /**
@@ -47,9 +46,8 @@ public class StoreLrValue extends Abstra
      * {@inheritDoc}
      */
     @Override
-    protected void setKerberosTime( KerberosTime krbtime, Asn1Container container )
+    protected void setKerberosTime( KerberosTime krbtime, LastReqContainer lastReqContainer )
     {
-        LastReqContainer lastReqContainer = ( LastReqContainer ) container;
         lastReqContainer.getLastReq().setCurrentLrValue( krbtime );
 
         lastReqContainer.setGrammarEndAllowed( true );

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/methodData/MethodDataGrammar.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/methodData/MethodDataGrammar.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/methodData/MethodDataGrammar.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/methodData/MethodDataGrammar.java Mon Feb  7 20:49:04 2011
@@ -6,16 +6,16 @@
  *  to you 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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.kerberos.codec.methodData;
 
@@ -34,10 +34,10 @@ import org.slf4j.LoggerFactory;
  * This class implements the METHOD-DATA structure. All the actions are declared
  * in this class. As it is a singleton, these declaration are only done once. If
  * an action is to be added or modified, this is where the work is to be done !
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public final class MethodDataGrammar extends AbstractGrammar
+public final class MethodDataGrammar extends AbstractGrammar<MethodDataContainer>
 {
     /** The logger */
     static final Logger LOG = LoggerFactory.getLogger( MethodDataGrammar.class );
@@ -46,12 +46,13 @@ public final class MethodDataGrammar ext
     static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     /** The instance of grammar. MethodDataGrammar is a singleton */
-    private static Grammar instance = new MethodDataGrammar();
+    private static Grammar<MethodDataContainer> instance = new MethodDataGrammar();
 
 
     /**
      * Creates a new MethodDataGrammar object.
      */
+    @SuppressWarnings("unchecked")
     private MethodDataGrammar()
     {
         setName( MethodDataGrammar.class.getName() );
@@ -66,27 +67,33 @@ public final class MethodDataGrammar ext
         // Transition from METHOD-DATA init to METHOD-DATA SEQ
         // --------------------------------------------------------------------------------------------
         // METHOD-DATA         ::= SEQUENCE
-        super.transitions[MethodDataStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            MethodDataStatesEnum.START_STATE, MethodDataStatesEnum.METHOD_DATA_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
-            new CheckNotNullLength() );
-        
+        super.transitions[MethodDataStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+            new GrammarTransition<MethodDataContainer>(
+            MethodDataStatesEnum.START_STATE,
+            MethodDataStatesEnum.METHOD_DATA_SEQ_STATE,
+            UniversalTag.SEQUENCE.getValue(),
+            new CheckNotNullLength<MethodDataContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from METHOD-DATA SEQ to PA-DATA
         // --------------------------------------------------------------------------------------------
         // METHOD-DATA         ::= SEQUENCE OF <PA-DATA>
-        // 
-        super.transitions[MethodDataStatesEnum.METHOD_DATA_SEQ_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            MethodDataStatesEnum.METHOD_DATA_SEQ_STATE, MethodDataStatesEnum.METHOD_DATA_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
+        //
+        super.transitions[MethodDataStatesEnum.METHOD_DATA_SEQ_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+            new GrammarTransition<MethodDataContainer>(
+            MethodDataStatesEnum.METHOD_DATA_SEQ_STATE,
+            MethodDataStatesEnum.METHOD_DATA_SEQ_STATE,
+            UniversalTag.SEQUENCE.getValue(),
             new AddPaData() );
     }
 
 
     /**
      * Get the instance of this grammar
-     * 
+     *
      * @return An instance on the METHOD-DATA Grammar
      */
-    public static Grammar getInstance()
+    public static Grammar<MethodDataContainer> getInstance()
     {
         return instance;
     }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/methodData/MethodDataStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/methodData/MethodDataStatesEnum.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/methodData/MethodDataStatesEnum.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/methodData/MethodDataStatesEnum.java Mon Feb  7 20:49:04 2011
@@ -6,16 +6,16 @@
  *  to you 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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.kerberos.codec.methodData;
 
@@ -27,23 +27,23 @@ import org.apache.directory.shared.asn1.
 /**
  * This class store the METHOD-DATA grammar's constants. It is also used for debugging
  * purpose
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public enum MethodDataStatesEnum implements States
 {
     // Start
     START_STATE,                         // 0
-    
+
     METHOD_DATA_SEQ_STATE,               // 1
-    
+
     // End
     LAST_METHOD_DATA_STATE;              // 2
 
-    
+
     /**
      * Get the grammar name
-     * 
+     *
      * @param grammar The grammar code
      * @return The grammar name
      */
@@ -55,11 +55,11 @@ public enum MethodDataStatesEnum impleme
 
     /**
      * Get the grammar name
-     * 
+     *
      * @param grammar The grammar class
      * @return The grammar name
      */
-    public String getGrammarName( Grammar grammar )
+    public String getGrammarName( Grammar<MethodDataContainer> grammar )
     {
         if ( grammar instanceof MethodDataGrammar )
         {
@@ -74,7 +74,7 @@ public enum MethodDataStatesEnum impleme
 
     /**
      * Get the string representing the state
-     * 
+     *
      * @param state The state number
      * @return The String representing the state
      */
@@ -83,7 +83,7 @@ public enum MethodDataStatesEnum impleme
         return ( ( state == LAST_METHOD_DATA_STATE.ordinal() ) ? "LAST_METHOD_DATA_STATE" : name() );
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
@@ -91,8 +91,8 @@ public enum MethodDataStatesEnum impleme
     {
         return this == LAST_METHOD_DATA_STATE;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/methodData/actions/AddPaData.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/methodData/actions/AddPaData.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/methodData/actions/AddPaData.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/methodData/actions/AddPaData.java Mon Feb  7 20:49:04 2011
@@ -6,25 +6,24 @@
  *  to you 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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.kerberos.codec.methodData.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
+import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
-import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.kerberos.codec.methodData.MethodDataContainer;
 import org.apache.directory.shared.kerberos.codec.padata.PaDataContainer;
@@ -35,10 +34,10 @@ import org.slf4j.LoggerFactory;
 
 /**
  * The action used to add an PA-DATA object
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AddPaData extends GrammarAction
+public class AddPaData extends GrammarAction<MethodDataContainer>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( AddPaData.class );
@@ -59,10 +58,8 @@ public class AddPaData extends GrammarAc
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    public void action( MethodDataContainer methodDataContainer ) throws DecoderException
     {
-        MethodDataContainer methodDataContainer = ( MethodDataContainer ) container;
-
         TLV tlv = methodDataContainer.getCurrentTLV();
 
         // The Length should not be null
@@ -73,43 +70,43 @@ public class AddPaData extends GrammarAc
             // This will generate a PROTOCOL_ERROR
             throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
         }
-        
+
         // Now, let's decode the PA-DATA
         Asn1Decoder paDataDecoder = new Asn1Decoder();
-        
+
         PaDataContainer paDataContainer = new PaDataContainer();
-        paDataContainer.setStream( container.getStream() );
-        
-        // Compute the start position in the stream for the PA-DATA to decode : 
+        paDataContainer.setStream( methodDataContainer.getStream() );
+
+        // Compute the start position in the stream for the PA-DATA to decode :
         // We have to move back to the PA-DATA tag
-        container.rewind();
+        methodDataContainer.rewind();
 
         // Decode the PA-DATA PDU
         try
         {
-            paDataDecoder.decode( container.getStream(), paDataContainer );
+            paDataDecoder.decode( methodDataContainer.getStream(), paDataContainer );
         }
         catch ( DecoderException de )
         {
             throw de;
         }
-        
+
         // Update the expected length for the current TLV
         tlv.setExpectedLength( tlv.getExpectedLength() - tlv.getLength() );
 
         // Update the parent
-        container.updateParent();
+        methodDataContainer.updateParent();
 
         // Store the PA-DATA in the container
         PaData paData = paDataContainer.getPaData();
         methodDataContainer.addPaData( paData );
-        
+
 
         if ( IS_DEBUG )
         {
             LOG.debug( "PA-DATA added : {}", paData );
         }
-        
-        container.setGrammarEndAllowed( true );
+
+        methodDataContainer.setGrammarEndAllowed( true );
     }
 }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/options/ApOptions.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/options/ApOptions.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/options/ApOptions.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/options/ApOptions.java Mon Feb  7 20:49:04 2011
@@ -6,16 +6,16 @@
  *  to you 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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.kerberos.codec.options;
 
@@ -23,6 +23,7 @@ package org.apache.directory.shared.kerb
 /**
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
+@SuppressWarnings("serial")
 public class ApOptions extends Options
 {
     /**
@@ -70,6 +71,7 @@ public class ApOptions extends Options
     /**
      * Converts the object to a printable string.
      */
+    @Override
     public String toString()
     {
         StringBuffer result = new StringBuffer();

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/options/KdcOptions.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/options/KdcOptions.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/options/KdcOptions.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/options/KdcOptions.java Mon Feb  7 20:49:04 2011
@@ -6,16 +6,16 @@
  *  to you 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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.kerberos.codec.options;
 
@@ -24,6 +24,7 @@ package org.apache.directory.shared.kerb
  * The list of possible KDC options.
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
+@SuppressWarnings("serial")
 public class KdcOptions extends Options
 {
     /**
@@ -216,6 +217,7 @@ public class KdcOptions extends Options
     /**
      * Converts the object to a printable string.
      */
+    @Override
     public String toString()
     {
         StringBuilder result = new StringBuilder();
@@ -225,13 +227,13 @@ public class KdcOptions extends Options
         {
             result.append( "RESERVED_0 " );
         }
-        
+
         // 1
         if ( get( FORWARDABLE ) )
         {
             result.append( "FORWARDABLE " );
         }
-        
+
         // 2
         if ( get( FORWARDED ) )
         {

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/options/Options.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/options/Options.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/options/Options.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/options/Options.java Mon Feb  7 20:49:04 2011
@@ -6,16 +6,16 @@
  *  to you 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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.kerberos.codec.options;
 
@@ -25,9 +25,10 @@ import org.apache.directory.shared.kerbe
 
 /**
  * A base class to manage Kerberos BitSet elements.
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
+@SuppressWarnings("serial")
 public abstract class Options extends AbstractKerberosFlags
 {
     /**
@@ -65,7 +66,7 @@ public abstract class Options extends Ab
         {
             throw new ArrayIndexOutOfBoundsException();
         }
-        
+
         return super.getBit( index );
     }
 
@@ -81,7 +82,7 @@ public abstract class Options extends Ab
         {
             return;
         }
-        
+
         setBit( index );
     }
 
@@ -97,7 +98,7 @@ public abstract class Options extends Ab
         {
             return;
         }
-        
+
         clearBit( index );
     }
 
@@ -106,7 +107,7 @@ public abstract class Options extends Ab
      * Byte-reversing methods are an anomaly of the BouncyCastle
      * DERBitString endianness. These methods can be removed if the
      * Apache Directory Snickers codecs operate differently.
-     * 
+     *
      * @return The raw {@link Options} bytes.
      */
     public byte[] getBytes()
@@ -123,11 +124,12 @@ public abstract class Options extends Ab
     {
         super.setData( bytes );
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
+    @Override
     public String toString()
     {
         return super.toString();



Mime
View raw message