directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1068124 [17/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/paEncTsEnc/PaEncTsEncGrammar.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/paEncTsEnc/PaEncTsEncGrammar.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/paEncTsEnc/PaEncTsEncGrammar.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/paEncTsEnc/PaEncTsEncGrammar.java Mon Feb  7 20:49:04 2011
@@ -6,25 +6,25 @@
  *  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.paEncTsEnc;
 
 
+import org.apache.directory.shared.asn1.actions.CheckNotNullLength;
 import org.apache.directory.shared.asn1.ber.grammar.AbstractGrammar;
 import org.apache.directory.shared.asn1.ber.grammar.Grammar;
 import org.apache.directory.shared.asn1.ber.grammar.GrammarTransition;
 import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
-import org.apache.directory.shared.asn1.actions.CheckNotNullLength;
 import org.apache.directory.shared.kerberos.KerberosConstants;
 import org.apache.directory.shared.kerberos.codec.paEncTsEnc.actions.PaEncTsEncInit;
 import org.apache.directory.shared.kerberos.codec.paEncTsEnc.actions.StorePaTimestamp;
@@ -37,10 +37,10 @@ import org.slf4j.LoggerFactory;
  * This class implements the PaEncTsEnc 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 PaEncTsEncGrammar extends AbstractGrammar
+public final class PaEncTsEncGrammar extends AbstractGrammar<PaEncTsEncContainer>
 {
     /** The logger */
     static final Logger LOG = LoggerFactory.getLogger( PaEncTsEncGrammar.class );
@@ -49,12 +49,13 @@ public final class PaEncTsEncGrammar ext
     static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     /** The instance of grammar. PaEncTsEncGrammar is a singleton */
-    private static Grammar instance = new PaEncTsEncGrammar();
+    private static Grammar<PaEncTsEncContainer> instance = new PaEncTsEncGrammar();
 
 
     /**
      * Creates a new PaEncTsEncrGrammar object.
      */
+    @SuppressWarnings("unchecked")
     private PaEncTsEncGrammar()
     {
         setName( PaEncTsEncGrammar.class.getName() );
@@ -63,44 +64,57 @@ public final class PaEncTsEncGrammar ext
         super.transitions = new GrammarTransition[PaEncTsEncStatesEnum.LAST_PA_ENC_TS_ENC_STATE.ordinal()][256];
 
         // ============================================================================================
-        // PaEncTsEnc 
+        // PaEncTsEnc
         // ============================================================================================
         // --------------------------------------------------------------------------------------------
         // Transition from PaEncTsEnc init to PaEncTsEnc SEQ
         // --------------------------------------------------------------------------------------------
         // PA-ENC-TS-ENC           ::= SEQUENCE {
-        super.transitions[PaEncTsEncStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            PaEncTsEncStatesEnum.START_STATE, PaEncTsEncStatesEnum.PA_ENC_TS_ENC_STATE, UniversalTag.SEQUENCE.getValue(),
-            new PaEncTsEncInit() );
-        
+        super.transitions[PaEncTsEncStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+            new GrammarTransition<PaEncTsEncContainer>(
+                PaEncTsEncStatesEnum.START_STATE,
+                PaEncTsEncStatesEnum.PA_ENC_TS_ENC_STATE,
+                UniversalTag.SEQUENCE.getValue(),
+                new PaEncTsEncInit() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from PaEncTsEnc SEQ to patimestamp tag
         // --------------------------------------------------------------------------------------------
         // PA-ENC-TS-ENC           ::= SEQUENCE {
         //         patimestamp     [0]
-        super.transitions[PaEncTsEncStatesEnum.PA_ENC_TS_ENC_STATE.ordinal()][KerberosConstants.PA_ENC_TS_ENC_PA_TIMESTAMP_TAG] = new GrammarTransition(
-            PaEncTsEncStatesEnum.PA_ENC_TS_ENC_STATE, PaEncTsEncStatesEnum.PA_ENC_TS_ENC_PA_TIMESTAMP_TAG_STATE, KerberosConstants.PA_ENC_TS_ENC_PA_TIMESTAMP_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[PaEncTsEncStatesEnum.PA_ENC_TS_ENC_STATE.ordinal()][KerberosConstants.PA_ENC_TS_ENC_PA_TIMESTAMP_TAG] =
+            new GrammarTransition<PaEncTsEncContainer>(
+                PaEncTsEncStatesEnum.PA_ENC_TS_ENC_STATE,
+                PaEncTsEncStatesEnum.PA_ENC_TS_ENC_PA_TIMESTAMP_TAG_STATE,
+                KerberosConstants.PA_ENC_TS_ENC_PA_TIMESTAMP_TAG,
+                new CheckNotNullLength<PaEncTsEncContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from patimestamp tag to patimestamp  value
         // --------------------------------------------------------------------------------------------
         // PA-ENC-TS-ENC           ::= SEQUENCE {
         //         patimestamp     [0] KerberosTime -- client's time --,
-        super.transitions[PaEncTsEncStatesEnum.PA_ENC_TS_ENC_PA_TIMESTAMP_TAG_STATE.ordinal()][UniversalTag.GENERALIZED_TIME.getValue()] = new GrammarTransition(
-            PaEncTsEncStatesEnum.PA_ENC_TS_ENC_PA_TIMESTAMP_TAG_STATE, PaEncTsEncStatesEnum.PA_ENC_TS_PA_TIMESTAMP_STATE, UniversalTag.GENERALIZED_TIME.getValue(),
-            new StorePaTimestamp() );
-        
+        super.transitions[PaEncTsEncStatesEnum.PA_ENC_TS_ENC_PA_TIMESTAMP_TAG_STATE.ordinal()][UniversalTag.GENERALIZED_TIME
+            .getValue()] =
+            new GrammarTransition<PaEncTsEncContainer>(
+                PaEncTsEncStatesEnum.PA_ENC_TS_ENC_PA_TIMESTAMP_TAG_STATE,
+                PaEncTsEncStatesEnum.PA_ENC_TS_PA_TIMESTAMP_STATE,
+                UniversalTag.GENERALIZED_TIME.getValue(),
+                new StorePaTimestamp() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from patimestamp value to pausec tag
         // --------------------------------------------------------------------------------------------
         // PA-ENC-TS-ENC           ::= SEQUENCE {
         //         ...
         //         pausec          [1]
-        super.transitions[PaEncTsEncStatesEnum.PA_ENC_TS_PA_TIMESTAMP_STATE.ordinal()][KerberosConstants.PA_ENC_TS_ENC_PA_USEC_TAG] = new GrammarTransition(
-            PaEncTsEncStatesEnum.PA_ENC_TS_PA_TIMESTAMP_STATE, PaEncTsEncStatesEnum.PA_ENC_TS_ENC_PA_USEC_TAG_STATE, KerberosConstants.PA_ENC_TS_ENC_PA_USEC_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[PaEncTsEncStatesEnum.PA_ENC_TS_PA_TIMESTAMP_STATE.ordinal()][KerberosConstants.PA_ENC_TS_ENC_PA_USEC_TAG] =
+            new GrammarTransition<PaEncTsEncContainer>(
+                PaEncTsEncStatesEnum.PA_ENC_TS_PA_TIMESTAMP_STATE,
+                PaEncTsEncStatesEnum.PA_ENC_TS_ENC_PA_USEC_TAG_STATE,
+                KerberosConstants.PA_ENC_TS_ENC_PA_USEC_TAG,
+                new CheckNotNullLength<PaEncTsEncContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from pausec tag to pausec value
         // --------------------------------------------------------------------------------------------
@@ -108,18 +122,22 @@ public final class PaEncTsEncGrammar ext
         //         ...
         //         pausec          [1] Microseconds OPTIONAL
         // }
-        super.transitions[PaEncTsEncStatesEnum.PA_ENC_TS_ENC_PA_USEC_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = new GrammarTransition(
-            PaEncTsEncStatesEnum.PA_ENC_TS_ENC_PA_USEC_TAG_STATE, PaEncTsEncStatesEnum.    PA_ENC_TS_ENC_PA_USEC_STATE, UniversalTag.INTEGER.getValue(),
-            new StorePaUsec() );
+        super.transitions[PaEncTsEncStatesEnum.PA_ENC_TS_ENC_PA_USEC_TAG_STATE.ordinal()][UniversalTag.INTEGER
+            .getValue()] =
+            new GrammarTransition<PaEncTsEncContainer>(
+                PaEncTsEncStatesEnum.PA_ENC_TS_ENC_PA_USEC_TAG_STATE,
+                PaEncTsEncStatesEnum.PA_ENC_TS_ENC_PA_USEC_STATE,
+                UniversalTag.INTEGER.getValue(),
+                new StorePaUsec() );
     }
 
 
     /**
      * Get the instance of this grammar
-     * 
+     *
      * @return An instance on the PA-ENC-TS-ENC Grammar
      */
-    public static Grammar getInstance()
+    public static Grammar<PaEncTsEncContainer> getInstance()
     {
         return instance;
     }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/paEncTsEnc/PaEncTsEncStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/paEncTsEnc/PaEncTsEncStatesEnum.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/paEncTsEnc/PaEncTsEncStatesEnum.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/paEncTsEnc/PaEncTsEncStatesEnum.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.paEncTsEnc;
 
@@ -27,30 +27,30 @@ import org.apache.directory.shared.asn1.
 /**
  * This class store the PA-ENC-TS-ENC grammar's constants. It is also used for debugging
  * purpose
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public enum PaEncTsEncStatesEnum implements States
 {
     // Start
     START_STATE,                              // 0
-    
+
     // ----- PA-ENC-TS-ENC message --------------------------------------
     PA_ENC_TS_ENC_STATE,                      // 1
-    
+
     PA_ENC_TS_ENC_PA_TIMESTAMP_TAG_STATE,     // 2
     PA_ENC_TS_PA_TIMESTAMP_STATE,             // 3
-    
+
     PA_ENC_TS_ENC_PA_USEC_TAG_STATE,          // 4
     PA_ENC_TS_ENC_PA_USEC_STATE,              // 4
-    
+
     // End
     LAST_PA_ENC_TS_ENC_STATE;                 // 5
 
-    
+
     /**
      * Get the grammar name
-     * 
+     *
      * @param grammar The grammar code
      * @return The grammar name
      */
@@ -62,11 +62,11 @@ public enum PaEncTsEncStatesEnum impleme
 
     /**
      * Get the grammar name
-     * 
+     *
      * @param grammar The grammar class
      * @return The grammar name
      */
-    public String getGrammarName( Grammar grammar )
+    public String getGrammarName( Grammar<PaEncTsEncContainer> grammar )
     {
         if ( grammar instanceof PaEncTsEncGrammar )
         {
@@ -81,7 +81,7 @@ public enum PaEncTsEncStatesEnum impleme
 
     /**
      * Get the string representing the state
-     * 
+     *
      * @param state The state number
      * @return The String representing the state
      */
@@ -90,7 +90,7 @@ public enum PaEncTsEncStatesEnum impleme
         return ( ( state == LAST_PA_ENC_TS_ENC_STATE.ordinal() ) ? "PA_ENC_TS_ENC_END_STATE" : name() );
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
@@ -98,8 +98,8 @@ public enum PaEncTsEncStatesEnum impleme
     {
         return this == LAST_PA_ENC_TS_ENC_STATE;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/paEncTsEnc/actions/PaEncTsEncInit.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/paEncTsEnc/actions/PaEncTsEncInit.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/paEncTsEnc/actions/PaEncTsEncInit.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/paEncTsEnc/actions/PaEncTsEncInit.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.paEncTsEnc.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 PA-ENC-TS-ENC object
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class PaEncTsEncInit extends GrammarAction
+public class PaEncTsEncInit extends GrammarAction<PaEncTsEncContainer>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( PaEncTsEncInit.class );
@@ -57,11 +56,9 @@ public class PaEncTsEncInit extends Gram
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    public void action( PaEncTsEncContainer paEncTsEncContainer ) throws DecoderException
     {
-        PaEncTsEncContainer encApRepPartContainer = ( PaEncTsEncContainer ) container;
-
-        TLV tlv = encApRepPartContainer.getCurrentTLV();
+        TLV tlv = paEncTsEncContainer.getCurrentTLV();
 
         // The Length should not be null
         if ( tlv.getLength() == 0 )
@@ -71,10 +68,10 @@ public class PaEncTsEncInit extends Gram
             // This will generate a PROTOCOL_ERROR
             throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
         }
-        
+
         PaEncTsEnc paEncTsEnc = new PaEncTsEnc();
-        encApRepPartContainer.setPaEncTsEnc( paEncTsEnc );
-        
+        paEncTsEncContainer.setPaEncTsEnc( paEncTsEnc );
+
         if ( IS_DEBUG )
         {
             LOG.debug( "PaEncTsEnc created" );

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/paEncTsEnc/actions/StorePaTimestamp.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/paEncTsEnc/actions/StorePaTimestamp.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/paEncTsEnc/actions/StorePaTimestamp.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/paEncTsEnc/actions/StorePaTimestamp.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.paEncTsEnc.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.paEncTsEnc.PaEncTsEncContainer;
@@ -28,10 +27,10 @@ import org.apache.directory.shared.kerbe
 
 /**
  * The action used to store the patimestamp KerberosTime
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StorePaTimestamp extends AbstractReadKerberosTime
+public class StorePaTimestamp extends AbstractReadKerberosTime<PaEncTsEncContainer>
 {
 
     /**
@@ -47,9 +46,8 @@ public class StorePaTimestamp extends Ab
      * {@inheritDoc}
      */
     @Override
-    protected void setKerberosTime( KerberosTime krbtime, Asn1Container container )
+    protected void setKerberosTime( KerberosTime krbtime, PaEncTsEncContainer paEncTsEncContainer )
     {
-        PaEncTsEncContainer paEncTsEncContainer = ( PaEncTsEncContainer ) container;
         paEncTsEncContainer.getPaEncTsEnc().setPaTimestamp( krbtime );
         paEncTsEncContainer.setGrammarEndAllowed( true );
     }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/paEncTsEnc/actions/StorePaUsec.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/paEncTsEnc/actions/StorePaUsec.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/paEncTsEnc/actions/StorePaUsec.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/paEncTsEnc/actions/StorePaUsec.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.paEncTsEnc.actions;
 
 
 import org.apache.directory.shared.asn1.actions.AbstractReadInteger;
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.kerberos.codec.paEncTsEnc.PaEncTsEncContainer;
 
 
 /**
  * The action used to store the pausec
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StorePaUsec extends AbstractReadInteger
+public class StorePaUsec extends AbstractReadInteger<PaEncTsEncContainer>
 {
 
     /**
@@ -46,9 +45,8 @@ public class StorePaUsec extends Abstrac
      * {@inheritDoc}
      */
     @Override
-    protected void setIntegerValue( int value, Asn1Container container )
+    protected void setIntegerValue( int value, PaEncTsEncContainer paEncTsEncContainer )
     {
-        PaEncTsEncContainer paEncTsEncContainer = ( PaEncTsEncContainer ) container;
         paEncTsEncContainer.getPaEncTsEnc().setPausec( value );
         paEncTsEncContainer.setGrammarEndAllowed( true );
     }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/padata/PaDataGrammar.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/padata/PaDataGrammar.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/padata/PaDataGrammar.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/padata/PaDataGrammar.java Mon Feb  7 20:49:04 2011
@@ -6,25 +6,25 @@
  *  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.padata;
 
 
+import org.apache.directory.shared.asn1.actions.CheckNotNullLength;
 import org.apache.directory.shared.asn1.ber.grammar.AbstractGrammar;
 import org.apache.directory.shared.asn1.ber.grammar.Grammar;
 import org.apache.directory.shared.asn1.ber.grammar.GrammarTransition;
 import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
-import org.apache.directory.shared.asn1.actions.CheckNotNullLength;
 import org.apache.directory.shared.kerberos.KerberosConstants;
 import org.apache.directory.shared.kerberos.codec.padata.actions.PaDataInit;
 import org.apache.directory.shared.kerberos.codec.padata.actions.StoreDataType;
@@ -37,10 +37,10 @@ import org.slf4j.LoggerFactory;
  * This class implements the PaData 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 PaDataGrammar extends AbstractGrammar
+public final class PaDataGrammar extends AbstractGrammar<PaDataContainer>
 {
     /** The logger */
     static final Logger LOG = LoggerFactory.getLogger( PaDataGrammar.class );
@@ -49,12 +49,13 @@ public final class PaDataGrammar extends
     static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     /** The instance of grammar. PaDataGrammar is a singleton */
-    private static Grammar instance = new PaDataGrammar();
+    private static Grammar<PaDataContainer> instance = new PaDataGrammar();
 
 
     /**
      * Creates a new PaDataGrammar object.
      */
+    @SuppressWarnings("unchecked")
     private PaDataGrammar()
     {
         setName( PaDataGrammar.class.getName() );
@@ -63,60 +64,75 @@ public final class PaDataGrammar extends
         super.transitions = new GrammarTransition[PaDataStatesEnum.LAST_PADATA_STATE.ordinal()][256];
 
         // ============================================================================================
-        // PaData 
+        // PaData
         // ============================================================================================
         // --------------------------------------------------------------------------------------------
         // Transition from PaData init to PaData SEQ OF
         // --------------------------------------------------------------------------------------------
         // PA-DATA         ::= SEQUENCE {
-        super.transitions[PaDataStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            PaDataStatesEnum.START_STATE, PaDataStatesEnum.PADATA_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
-            new PaDataInit() );
-        
+        super.transitions[PaDataStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+            new GrammarTransition<PaDataContainer>(
+                PaDataStatesEnum.START_STATE,
+                PaDataStatesEnum.PADATA_SEQ_STATE,
+                UniversalTag.SEQUENCE.getValue(),
+                new PaDataInit() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from PaData SEQ to padata-type tag
         // --------------------------------------------------------------------------------------------
         // PA-DATA         ::= SEQUENCE {
         //       padata-type     [1]
-        super.transitions[PaDataStatesEnum.PADATA_SEQ_STATE.ordinal()][KerberosConstants.PADATA_TYPE_TAG] = new GrammarTransition(
-            PaDataStatesEnum.PADATA_SEQ_STATE, PaDataStatesEnum.PADATA_TYPE_TAG_STATE, KerberosConstants.PADATA_TYPE_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[PaDataStatesEnum.PADATA_SEQ_STATE.ordinal()][KerberosConstants.PADATA_TYPE_TAG] =
+            new GrammarTransition<PaDataContainer>(
+                PaDataStatesEnum.PADATA_SEQ_STATE,
+                PaDataStatesEnum.PADATA_TYPE_TAG_STATE,
+                KerberosConstants.PADATA_TYPE_TAG,
+                new CheckNotNullLength<PaDataContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from PaData type tag to padata-type
         // --------------------------------------------------------------------------------------------
         // PA-DATA         ::= SEQUENCE {
         //       padata-type     [1] Int32
-        super.transitions[PaDataStatesEnum.PADATA_TYPE_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = new GrammarTransition(
-            PaDataStatesEnum.PADATA_TYPE_TAG_STATE, PaDataStatesEnum.PADATA_TYPE_STATE, UniversalTag.INTEGER.getValue(),
-            new StoreDataType() );
-        
+        super.transitions[PaDataStatesEnum.PADATA_TYPE_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] =
+            new GrammarTransition<PaDataContainer>(
+                PaDataStatesEnum.PADATA_TYPE_TAG_STATE,
+                PaDataStatesEnum.PADATA_TYPE_STATE,
+                UniversalTag.INTEGER.getValue(),
+                new StoreDataType() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from padata-type to padata-value tag
         // --------------------------------------------------------------------------------------------
         // PA-DATA         ::= SEQUENCE {
         //          padata-value    [2]
-        super.transitions[PaDataStatesEnum.PADATA_TYPE_STATE.ordinal()][KerberosConstants.PADATA_VALUE_TAG] = new GrammarTransition(
-            PaDataStatesEnum.PADATA_TYPE_STATE, PaDataStatesEnum.PADATA_VALUE_TAG_STATE, KerberosConstants.PADATA_VALUE_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[PaDataStatesEnum.PADATA_TYPE_STATE.ordinal()][KerberosConstants.PADATA_VALUE_TAG] =
+            new GrammarTransition<PaDataContainer>(
+                PaDataStatesEnum.PADATA_TYPE_STATE,
+                PaDataStatesEnum.PADATA_VALUE_TAG_STATE,
+                KerberosConstants.PADATA_VALUE_TAG,
+                new CheckNotNullLength<PaDataContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from padata-value tag to padata-value
         // --------------------------------------------------------------------------------------------
         // PA-DATA         ::= SEQUENCE {
         //          padata-value    [2] OCTET STRING
-        super.transitions[PaDataStatesEnum.PADATA_VALUE_TAG_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
-            PaDataStatesEnum.PADATA_VALUE_TAG_STATE, PaDataStatesEnum.PADATA_VALUE_STATE, UniversalTag.OCTET_STRING.getValue(),
-            new StorePaDataValue() );
+        super.transitions[PaDataStatesEnum.PADATA_VALUE_TAG_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] =
+            new GrammarTransition<PaDataContainer>(
+                PaDataStatesEnum.PADATA_VALUE_TAG_STATE,
+                PaDataStatesEnum.PADATA_VALUE_STATE,
+                UniversalTag.OCTET_STRING.getValue(),
+                new StorePaDataValue() );
     }
 
 
     /**
      * Get the instance of this grammar
-     * 
+     *
      * @return An instance on the PaData Grammar
      */
-    public static Grammar getInstance()
+    public static Grammar<PaDataContainer> getInstance()
     {
         return instance;
     }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/padata/PaDataStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/padata/PaDataStatesEnum.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/padata/PaDataStatesEnum.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/padata/PaDataStatesEnum.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.padata;
 
@@ -27,31 +27,31 @@ import org.apache.directory.shared.asn1.
 /**
  * This class store the PaData grammar's constants. It is also used for debugging
  * purpose
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public enum PaDataStatesEnum implements States
 {
     // Start
     START_STATE,                  // 0
-    
+
     PADATA_SEQ_STATE,             // 1
-    
+
     PADATA_TYPE_TAG_STATE,        // 2
-    
+
     PADATA_TYPE_STATE,            // 3
-    
+
     PADATA_VALUE_TAG_STATE,       // 4
-    
+
     PADATA_VALUE_STATE,           // 5
-    
+
     // End
-    LAST_PADATA_STATE; // 6
+    LAST_PADATA_STATE;            // 6
+
 
-    
     /**
      * Get the grammar name
-     * 
+     *
      * @param grammar The grammar code
      * @return The grammar name
      */
@@ -63,11 +63,11 @@ public enum PaDataStatesEnum implements 
 
     /**
      * Get the grammar name
-     * 
+     *
      * @param grammar The grammar class
      * @return The grammar name
      */
-    public String getGrammarName( Grammar grammar )
+    public String getGrammarName( Grammar<PaDataContainer> grammar )
     {
         if ( grammar instanceof PaDataGrammar )
         {
@@ -82,7 +82,7 @@ public enum PaDataStatesEnum implements 
 
     /**
      * Get the string representing the state
-     * 
+     *
      * @param state The state number
      * @return The String representing the state
      */
@@ -91,7 +91,7 @@ public enum PaDataStatesEnum implements 
         return ( ( state == LAST_PADATA_STATE.ordinal() ) ? "LAST_PADATA_STATE" : name() );
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
@@ -99,8 +99,8 @@ public enum PaDataStatesEnum implements 
     {
         return this == LAST_PADATA_STATE;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/padata/actions/PaDataInit.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/padata/actions/PaDataInit.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/padata/actions/PaDataInit.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/padata/actions/PaDataInit.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.padata.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 PaData object
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class PaDataInit extends GrammarAction
+public class PaDataInit extends GrammarAction<PaDataContainer>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( PaDataInit.class );
@@ -57,10 +56,8 @@ public class PaDataInit extends GrammarA
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    public void action( PaDataContainer paDataContainer ) throws DecoderException
     {
-        PaDataContainer paDataContainer = ( PaDataContainer ) container;
-
         TLV tlv = paDataContainer.getCurrentTLV();
 
         // The Length should not be null
@@ -71,10 +68,10 @@ public class PaDataInit extends GrammarA
             // This will generate a PROTOCOL_ERROR
             throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
         }
-        
+
         PaData paData = new PaData();
         paDataContainer.setPaData( paData );
-        
+
         if ( IS_DEBUG )
         {
             LOG.debug( "PaData created" );

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/padata/actions/StoreDataType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/padata/actions/StoreDataType.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/padata/actions/StoreDataType.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/padata/actions/StoreDataType.java Mon Feb  7 20:49:04 2011
@@ -22,12 +22,11 @@ package org.apache.directory.shared.kerb
 
 
 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.IntegerDecoder;
+import org.apache.directory.shared.asn1.ber.tlv.IntegerDecoderException;
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
-import org.apache.directory.shared.asn1.ber.tlv.IntegerDecoderException;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.kerberos.codec.padata.PaDataContainer;
 import org.apache.directory.shared.kerberos.codec.types.PaDataType;
@@ -42,7 +41,7 @@ import org.slf4j.LoggerFactory;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreDataType extends GrammarAction
+public class StoreDataType extends GrammarAction<PaDataContainer>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( StoreDataType.class );
@@ -63,10 +62,8 @@ public class StoreDataType extends Gramm
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    public void action( PaDataContainer paDataContainer ) throws DecoderException
     {
-        PaDataContainer paDataContainer = ( PaDataContainer ) container;
-
         TLV tlv = paDataContainer.getCurrentTLV();
 
         // The Length should not be null

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/padata/actions/StorePaDataValue.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/padata/actions/StorePaDataValue.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/padata/actions/StorePaDataValue.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/padata/actions/StorePaDataValue.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.padata.actions;
 
 
 import org.apache.directory.shared.asn1.actions.AbstractReadOctetString;
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.kerberos.codec.padata.PaDataContainer;
 
 
 /**
  * The action used to store the PaData's padata-value
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StorePaDataValue extends AbstractReadOctetString
+public class StorePaDataValue extends AbstractReadOctetString<PaDataContainer>
 {
     /**
      * Instantiates a new PaDataValue action.
@@ -45,10 +44,9 @@ public class StorePaDataValue extends Ab
      * {@inheritDoc}
      */
     @Override
-    protected void setOctetString( byte[] data, Asn1Container container )
+    protected void setOctetString( byte[] data, PaDataContainer paDataContainer )
     {
-        PaDataContainer paDataContainer = ( PaDataContainer ) container;
         paDataContainer.getPaData().setPaDataValue( data );
-        container.setGrammarEndAllowed( true );
+        paDataContainer.setGrammarEndAllowed( true );
     }
 }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/principalName/PrincipalNameGrammar.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/principalName/PrincipalNameGrammar.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/principalName/PrincipalNameGrammar.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/principalName/PrincipalNameGrammar.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.principalName;
 
@@ -37,10 +37,10 @@ import org.slf4j.LoggerFactory;
  * This class implements the PrincipalName. 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 PrincipalNameGrammar extends AbstractGrammar
+public final class PrincipalNameGrammar extends AbstractGrammar<PrincipalNameContainer>
 {
     /** The logger */
     static final Logger LOG = LoggerFactory.getLogger( PrincipalNameGrammar.class );
@@ -49,12 +49,13 @@ public final class PrincipalNameGrammar 
     static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     /** The instance of grammar. PrincipalNameGrammar is a singleton */
-    private static Grammar instance = new PrincipalNameGrammar();
+    private static Grammar<PrincipalNameContainer> instance = new PrincipalNameGrammar();
 
 
     /**
      * Creates a new PrincipalNameGrammar object.
      */
+    @SuppressWarnings("unchecked")
     private PrincipalNameGrammar()
     {
         setName( PrincipalNameGrammar.class.getName() );
@@ -63,76 +64,93 @@ public final class PrincipalNameGrammar 
         super.transitions = new GrammarTransition[PrincipalNameStatesEnum.LAST_PRINCIPAL_NAME_STATE.ordinal()][256];
 
         // ============================================================================================
-        // PrincipalName 
+        // PrincipalName
         // ============================================================================================
         // --------------------------------------------------------------------------------------------
         // Transition from PrincipalName init to PrincipalName SEQ
         // --------------------------------------------------------------------------------------------
         // PrincipalName   ::= SEQUENCE
-        super.transitions[PrincipalNameStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            PrincipalNameStatesEnum.START_STATE, PrincipalNameStatesEnum.PRINCIPAL_NAME_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
-            new PrincipalNameInit() ) ;
-        
-        
+        super.transitions[PrincipalNameStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+            new GrammarTransition<PrincipalNameContainer>(
+                PrincipalNameStatesEnum.START_STATE,
+                PrincipalNameStatesEnum.PRINCIPAL_NAME_SEQ_STATE,
+                UniversalTag.SEQUENCE.getValue(),
+                new PrincipalNameInit() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from PrincipalName SEQ to name-type tag
         // --------------------------------------------------------------------------------------------
         // PrincipalName   ::= SEQUENCE {
         //         name-type       [0] Int32,
-        super.transitions[PrincipalNameStatesEnum.PRINCIPAL_NAME_SEQ_STATE.ordinal()][KerberosConstants.PRINCIPAL_NAME_NAME_TYPE_TAG] = new GrammarTransition(
-            PrincipalNameStatesEnum.PRINCIPAL_NAME_SEQ_STATE, PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_TYPE_TAG_STATE, KerberosConstants.PRINCIPAL_NAME_NAME_TYPE_TAG,
-            new CheckNotNullLength() );
-        
-        
+        super.transitions[PrincipalNameStatesEnum.PRINCIPAL_NAME_SEQ_STATE.ordinal()][KerberosConstants.PRINCIPAL_NAME_NAME_TYPE_TAG] =
+            new GrammarTransition<PrincipalNameContainer>(
+                PrincipalNameStatesEnum.PRINCIPAL_NAME_SEQ_STATE,
+                PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_TYPE_TAG_STATE,
+                KerberosConstants.PRINCIPAL_NAME_NAME_TYPE_TAG,
+                new CheckNotNullLength<PrincipalNameContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from name-type tag to name-type value
         // --------------------------------------------------------------------------------------------
         // PrincipalName   ::= SEQUENCE {
         //         name-type       [0] Int32,
-        super.transitions[PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_TYPE_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = new GrammarTransition(
-            PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_TYPE_TAG_STATE, PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_TYPE_STATE, UniversalTag.INTEGER.getValue(),
-            new StoreNameType() );
-        
-        
+        super.transitions[PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_TYPE_TAG_STATE.ordinal()][UniversalTag.INTEGER
+            .getValue()] =
+            new GrammarTransition<PrincipalNameContainer>(
+                PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_TYPE_TAG_STATE,
+                PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_TYPE_STATE,
+                UniversalTag.INTEGER.getValue(),
+                new StoreNameType() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from name-type value to name-string tag
         // --------------------------------------------------------------------------------------------
         // PrincipalName   ::= SEQUENCE {
         //         name-type       [0] Int32,
         //         name-string     [1]
-        super.transitions[PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_TYPE_STATE.ordinal()][KerberosConstants.PRINCIPAL_NAME_NAME_STRING_TAG] = new GrammarTransition(
-            PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_TYPE_STATE, PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_STRING_TAG_STATE, KerberosConstants.PRINCIPAL_NAME_NAME_STRING_TAG,
-            new CheckNotNullLength() );
-        
-        
+        super.transitions[PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_TYPE_STATE.ordinal()][KerberosConstants.PRINCIPAL_NAME_NAME_STRING_TAG] =
+            new GrammarTransition<PrincipalNameContainer>(
+                PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_TYPE_STATE,
+                PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_STRING_TAG_STATE,
+                KerberosConstants.PRINCIPAL_NAME_NAME_STRING_TAG,
+                new CheckNotNullLength<PrincipalNameContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from name-string tag to name-string SEQ
         // --------------------------------------------------------------------------------------------
         // PrincipalName   ::= SEQUENCE {
         //         name-type       [0] Int32,
         //         name-string     [1] SEQUENCE OF
-        super.transitions[PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_STRING_TAG_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_STRING_TAG_STATE, PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_STRING_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
-            new CheckNotNullLength() );
-        
-        
+        super.transitions[PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_STRING_TAG_STATE.ordinal()][UniversalTag.SEQUENCE
+            .getValue()] =
+            new GrammarTransition<PrincipalNameContainer>(
+                PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_STRING_TAG_STATE,
+                PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_STRING_SEQ_STATE,
+                UniversalTag.SEQUENCE.getValue(),
+                new CheckNotNullLength<PrincipalNameContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from name-string SEQ to name-string value
         // --------------------------------------------------------------------------------------------
         // PrincipalName   ::= SEQUENCE {
         //         name-type       [0] Int32,
         //         name-string     [1] SEQUENCE OF KerberosString
-        super.transitions[PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_STRING_SEQ_STATE.ordinal()][UniversalTag.GENERAL_STRING.getValue()] = new GrammarTransition(
-            PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_STRING_SEQ_STATE, PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_STRING_SEQ_STATE, UniversalTag.GENERAL_STRING.getValue(),
-            new StoreNameString() );
+        super.transitions[PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_STRING_SEQ_STATE.ordinal()][UniversalTag.GENERAL_STRING
+            .getValue()] =
+            new GrammarTransition<PrincipalNameContainer>(
+                PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_STRING_SEQ_STATE,
+                PrincipalNameStatesEnum.PRINCIPAL_NAME_NAME_STRING_SEQ_STATE,
+                UniversalTag.GENERAL_STRING.getValue(),
+                new StoreNameString() );
     }
 
+
     /**
      * Get the instance of this grammar
-     * 
+     *
      * @return An instance on the PrincipalName Grammar
      */
-    public static Grammar getInstance()
+    public static Grammar<PrincipalNameContainer> getInstance()
     {
         return instance;
     }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/principalName/PrincipalNameStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/principalName/PrincipalNameStatesEnum.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/principalName/PrincipalNameStatesEnum.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/principalName/PrincipalNameStatesEnum.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.principalName;
 
@@ -27,32 +27,32 @@ import org.apache.directory.shared.asn1.
 /**
  * This class store the PrincipalName grammar's constants. It is also used for debugging
  * purpose
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public enum PrincipalNameStatesEnum implements States
 {
     // Start
     START_STATE,                            // 0
-    
+
     // ----- PrincipalName message --------------------------------------
     PRINCIPAL_NAME_SEQ_STATE,               // 1
-    
+
     PRINCIPAL_NAME_NAME_TYPE_TAG_STATE,     // 2
     PRINCIPAL_NAME_NAME_TYPE_STATE,         // 3
-    
+
     PRINCIPAL_NAME_NAME_STRING_SEQ_STATE,   // 4
-    
+
     PRINCIPAL_NAME_NAME_STRING_TAG_STATE,   // 5
     PRINCIPAL_NAME_NAME_STRING_STATE,       // 6
-    
+
     // End
     LAST_PRINCIPAL_NAME_STATE;              // 7
 
-    
+
     /**
      * Get the grammar name
-     * 
+     *
      * @param grammar The grammar code
      * @return The grammar name
      */
@@ -64,11 +64,11 @@ public enum PrincipalNameStatesEnum impl
 
     /**
      * Get the grammar name
-     * 
+     *
      * @param grammar The grammar class
      * @return The grammar name
      */
-    public String getGrammarName( Grammar grammar )
+    public String getGrammarName( Grammar<PrincipalNameContainer> grammar )
     {
         if ( grammar instanceof PrincipalNameGrammar )
         {
@@ -83,7 +83,7 @@ public enum PrincipalNameStatesEnum impl
 
     /**
      * Get the string representing the state
-     * 
+     *
      * @param state The state number
      * @return The String representing the state
      */
@@ -92,7 +92,7 @@ public enum PrincipalNameStatesEnum impl
         return ( ( state == LAST_PRINCIPAL_NAME_STATE.ordinal() ) ? "PRINCIPAL_NAME_END_STATE" : name() );
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
@@ -100,8 +100,8 @@ public enum PrincipalNameStatesEnum impl
     {
         return this == LAST_PRINCIPAL_NAME_STATE;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/principalName/actions/PrincipalNameInit.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/principalName/actions/PrincipalNameInit.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/principalName/actions/PrincipalNameInit.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/principalName/actions/PrincipalNameInit.java Mon Feb  7 20:49:04 2011
@@ -6,23 +6,22 @@
  *  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.principalName.actions;
 
 
 import org.apache.directory.server.i18n.I18n;
 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.kerberos.codec.principalName.PrincipalNameContainer;
@@ -33,10 +32,10 @@ import org.slf4j.LoggerFactory;
 
 /**
  * The action used to initialize the PrincipalName object
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class PrincipalNameInit extends GrammarAction
+public class PrincipalNameInit extends GrammarAction<PrincipalNameContainer>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( PrincipalNameInit.class );
@@ -57,10 +56,8 @@ public class PrincipalNameInit extends G
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    public void action( PrincipalNameContainer principalNameContainer ) throws DecoderException
     {
-        PrincipalNameContainer principalNameContainer = ( PrincipalNameContainer ) container;
-
         TLV tlv = principalNameContainer.getCurrentTLV();
 
         // The Length should not be null
@@ -71,11 +68,11 @@ public class PrincipalNameInit extends G
             // This will generate a PROTOCOL_ERROR
             throw new DecoderException( I18n.err( I18n.ERR_744_NULL_PDU_LENGTH ) );
         }
-        
+
         // We have to create a PrincipalName object here
         PrincipalName principalName = new PrincipalName();
         principalNameContainer.setPrincipalName( principalName );
-        
+
         if ( IS_DEBUG )
         {
             LOG.debug( "PrincipalName created" );

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/principalName/actions/StoreNameString.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/principalName/actions/StoreNameString.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/principalName/actions/StoreNameString.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/principalName/actions/StoreNameString.java Mon Feb  7 20:49:04 2011
@@ -6,26 +6,25 @@
  *  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.principalName.actions;
 
 
 import org.apache.directory.server.i18n.I18n;
-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.ber.tlv.Value;
-import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.kerberos.KerberosUtils;
 import org.apache.directory.shared.kerberos.codec.principalName.PrincipalNameContainer;
 import org.apache.directory.shared.kerberos.components.PrincipalName;
@@ -36,10 +35,10 @@ import org.slf4j.LoggerFactory;
 
 /**
  * The action used to store the PrincipalName string
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreNameString extends GrammarAction
+public class StoreNameString extends GrammarAction<PrincipalNameContainer>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( StoreNameString.class );
@@ -60,10 +59,8 @@ public class StoreNameString extends Gra
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    public void action( PrincipalNameContainer principalNameContainer ) throws DecoderException
     {
-        PrincipalNameContainer principalNameContainer = ( PrincipalNameContainer ) container;
-
         TLV tlv = principalNameContainer.getCurrentTLV();
 
         // The Length should not be null
@@ -74,20 +71,20 @@ public class StoreNameString extends Gra
             // This will generate a PROTOCOL_ERROR
             throw new DecoderException( I18n.err( I18n.ERR_744_NULL_PDU_LENGTH ) );
         }
-        
+
         // Get the principalName
         PrincipalName principalName = principalNameContainer.getPrincipalName();
-        
+
         Value value = tlv.getValue();
-        
+
         // The PrincipalName must be pure ASCII witout any control character
         if ( KerberosUtils.isKerberosString( value.getData() ) )
         {
             String nameString = Strings.utf8ToString(value.getData());
-    
+
             principalName.addName( nameString );
             principalNameContainer.setGrammarEndAllowed( true );
-            
+
             if ( IS_DEBUG )
             {
                 LOG.debug( "PrincipalName String : {}", nameString );
@@ -99,7 +96,7 @@ public class StoreNameString extends Gra
             String valStr = Strings.utf8ToString(value.getData());
             String valAll = valBytes + "/" + valStr;
             LOG.error( I18n.err( I18n.ERR_745_NOT_A_KERBEROS_STRING, valAll ) );
-    
+
             // This will generate a PROTOCOL_ERROR
             throw new DecoderException( I18n.err( I18n.ERR_745_NOT_A_KERBEROS_STRING, valAll ) );
         }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/principalName/actions/StoreNameType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/principalName/actions/StoreNameType.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/principalName/actions/StoreNameType.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/principalName/actions/StoreNameType.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.principalName.actions;
 
 
 import org.apache.directory.shared.asn1.actions.AbstractReadInteger;
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.kerberos.codec.principalName.PrincipalNameContainer;
 import org.apache.directory.shared.kerberos.codec.types.PrincipalNameType;
 import org.apache.directory.shared.kerberos.components.PrincipalName;
@@ -31,10 +30,10 @@ import org.slf4j.LoggerFactory;
 
 /**
  * The action used to store the PrincipalName type
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreNameType extends AbstractReadInteger
+public class StoreNameType extends AbstractReadInteger<PrincipalNameContainer>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( StoreNameType.class );
@@ -55,14 +54,13 @@ public class StoreNameType extends Abstr
      * {@inheritDoc}
      */
     @Override
-    protected void setIntegerValue( int value, Asn1Container container )
+    protected void setIntegerValue( int value, PrincipalNameContainer principalNameContainer )
     {
-        PrincipalNameContainer principalNameContainer = ( PrincipalNameContainer ) container;
         PrincipalName principalName = principalNameContainer.getPrincipalName();
-        
+
         PrincipalNameType principalNameType = PrincipalNameType.getTypeByValue( value );
         principalName.setNameType( principalNameType );
-        
+
         if ( IS_DEBUG )
         {
             LOG.debug( "name-type : {}" + principalNameType );

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsRep/TgsRepGrammar.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsRep/TgsRepGrammar.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsRep/TgsRepGrammar.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsRep/TgsRepGrammar.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.tgsRep;
 
@@ -33,10 +33,10 @@ import org.slf4j.LoggerFactory;
  * This class implements the TGS-REP 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 TgsRepGrammar extends AbstractGrammar
+public final class TgsRepGrammar extends AbstractGrammar<TgsRepContainer>
 {
     /** The logger */
     static final Logger LOG = LoggerFactory.getLogger( TgsRepGrammar.class );
@@ -45,12 +45,13 @@ public final class TgsRepGrammar extends
     static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     /** The instance of grammar. TgsRepGrammar is a singleton */
-    private static Grammar instance = new TgsRepGrammar();
+    private static Grammar<TgsRepContainer> instance = new TgsRepGrammar();
 
 
     /**
      * Creates a new TgsRepGrammar object.
      */
+    @SuppressWarnings("unchecked")
     private TgsRepGrammar()
     {
         setName( TgsRepGrammar.class.getName() );
@@ -59,24 +60,27 @@ public final class TgsRepGrammar extends
         super.transitions = new GrammarTransition[TgsRepStatesEnum.LAST_TGS_REP_STATE.ordinal()][256];
 
         // ============================================================================================
-        // TS-REP 
+        // TS-REP
         // ============================================================================================
         // --------------------------------------------------------------------------------------------
         // Transition from TS-REP init to KDC-REP
         // --------------------------------------------------------------------------------------------
         // TGS-REP          ::= [APPLICATION 13] KDC-REP
-        super.transitions[TgsRepStatesEnum.START_STATE.ordinal()][KerberosConstants.TGS_REP_TAG] = new GrammarTransition(
-            TgsRepStatesEnum.START_STATE, TgsRepStatesEnum.TGS_REP_STATE, KerberosConstants.TGS_REP_TAG,
-            new StoreKdcRep() );
+        super.transitions[TgsRepStatesEnum.START_STATE.ordinal()][KerberosConstants.TGS_REP_TAG] =
+            new GrammarTransition<TgsRepContainer>(
+                TgsRepStatesEnum.START_STATE,
+                TgsRepStatesEnum.TGS_REP_STATE,
+                KerberosConstants.TGS_REP_TAG,
+                new StoreKdcRep() );
     }
 
 
     /**
      * Get the instance of this grammar
-     * 
+     *
      * @return An instance on the AS-REP Grammar
      */
-    public static Grammar getInstance()
+    public static Grammar<TgsRepContainer> getInstance()
     {
         return instance;
     }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsRep/TgsRepStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsRep/TgsRepStatesEnum.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsRep/TgsRepStatesEnum.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsRep/TgsRepStatesEnum.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.tgsRep;
 
@@ -27,24 +27,24 @@ import org.apache.directory.shared.asn1.
 /**
  * This class store the TGS-REP grammar's constants. It is also used for debugging
  * purpose
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public enum TgsRepStatesEnum implements States
 {
     // Start
     START_STATE,                            // 0
-    
+
     // ----- HostAddresses message --------------------------------------
     TGS_REP_STATE,                           // 1
-    
+
     // End
     LAST_TGS_REP_STATE;                      // 2
 
-    
+
     /**
      * Get the grammar name
-     * 
+     *
      * @param grammar The grammar code
      * @return The grammar name
      */
@@ -56,11 +56,11 @@ public enum TgsRepStatesEnum implements 
 
     /**
      * Get the grammar name
-     * 
+     *
      * @param grammar The grammar class
      * @return The grammar name
      */
-    public String getGrammarName( Grammar grammar )
+    public String getGrammarName( Grammar<TgsRepContainer> grammar )
     {
         if ( grammar instanceof TgsRepGrammar )
         {
@@ -75,7 +75,7 @@ public enum TgsRepStatesEnum implements 
 
     /**
      * Get the string representing the state
-     * 
+     *
      * @param state The state number
      * @return The String representing the state
      */
@@ -84,7 +84,7 @@ public enum TgsRepStatesEnum implements 
         return ( ( state == LAST_TGS_REP_STATE.ordinal() ) ? "TGS_REP_END_STATE" : name() );
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
@@ -92,8 +92,8 @@ public enum TgsRepStatesEnum implements 
     {
         return this == LAST_TGS_REP_STATE;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsRep/actions/StoreKdcRep.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsRep/actions/StoreKdcRep.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsRep/actions/StoreKdcRep.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsRep/actions/StoreKdcRep.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.tgsRep.actions;
 
 
 import org.apache.directory.shared.asn1.DecoderException;
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 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;
@@ -36,10 +35,10 @@ import org.slf4j.LoggerFactory;
 
 /**
  * The action used to add a KDC-REP object
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreKdcRep extends GrammarAction
+public class StoreKdcRep extends GrammarAction<TgsRepContainer>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( StoreKdcRep.class );
@@ -60,10 +59,8 @@ public class StoreKdcRep extends Grammar
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    public void action( TgsRepContainer tgsRepContainer ) throws DecoderException
     {
-        TgsRepContainer tgsRepContainer = ( TgsRepContainer ) container;
-
         TLV tlv = tgsRepContainer.getCurrentTLV();
 
         // The Length should not be null
@@ -74,37 +71,37 @@ public class StoreKdcRep extends Grammar
             // This will generate a PROTOCOL_ERROR
             throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
         }
-        
+
         // Now, let's decode the KDC-REP
         Asn1Decoder kdcRepDecoder = new Asn1Decoder();
-        
-        KdcRepContainer kdcRepContainer = new KdcRepContainer( container.getStream() );
-        
+
+        KdcRepContainer kdcRepContainer = new KdcRepContainer( tgsRepContainer.getStream() );
+
         // Store the created TGS-REP object into the KDC-REP container
         TgsRep tgsRep = new TgsRep();
         kdcRepContainer.setKdcRep( tgsRep );
-        
+
         // Decode the KDC_REP PDU
         try
         {
-            kdcRepDecoder.decode( container.getStream(), kdcRepContainer );
+            kdcRepDecoder.decode( tgsRepContainer.getStream(), kdcRepContainer );
         }
         catch ( DecoderException de )
         {
             throw de;
         }
-        
+
         // Update the expected length for the current TLV
         tlv.setExpectedLength( tlv.getExpectedLength() - tlv.getLength() );
 
         // Update the parent
-        container.updateParent();
-        
+        tgsRepContainer.updateParent();
+
         if ( tgsRep.getMessageType() != KerberosMessageType.TGS_REP )
         {
             throw new DecoderException( "Bad message type" );
         }
-        
+
 
         tgsRepContainer.setTgsRep( tgsRep );
 
@@ -112,7 +109,7 @@ public class StoreKdcRep extends Grammar
         {
             LOG.debug( "TGS-REP : {}", tgsRep );
         }
-        
-        container.setGrammarEndAllowed( true );
+
+        tgsRepContainer.setGrammarEndAllowed( true );
     }
 }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsReq/TgsReqGrammar.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsReq/TgsReqGrammar.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsReq/TgsReqGrammar.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsReq/TgsReqGrammar.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.tgsReq;
 
@@ -33,10 +33,10 @@ import org.slf4j.LoggerFactory;
  * This class implements the TGS-REQ 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 TgsReqGrammar extends AbstractGrammar
+public final class TgsReqGrammar extends AbstractGrammar<TgsReqContainer>
 {
     /** The logger */
     static final Logger LOG = LoggerFactory.getLogger( TgsReqGrammar.class );
@@ -45,12 +45,13 @@ public final class TgsReqGrammar extends
     static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     /** The instance of grammar. TgsReqGrammar is a singleton */
-    private static Grammar instance = new TgsReqGrammar();
+    private static Grammar<TgsReqContainer> instance = new TgsReqGrammar();
 
 
     /**
      * Creates a new TgsReqGrammar object.
      */
+    @SuppressWarnings("unchecked")
     private TgsReqGrammar()
     {
         setName( TgsReqGrammar.class.getName() );
@@ -59,24 +60,27 @@ public final class TgsReqGrammar extends
         super.transitions = new GrammarTransition[TgsReqStatesEnum.LAST_TGS_REQ_STATE.ordinal()][256];
 
         // ============================================================================================
-        // TS-REQ 
+        // TS-REQ
         // ============================================================================================
         // --------------------------------------------------------------------------------------------
         // Transition from TS-REQ init to KDC-REQ
         // --------------------------------------------------------------------------------------------
         // TGS-REQ          ::= [APPLICATION 12] KDC-REQ
-        super.transitions[TgsReqStatesEnum.START_STATE.ordinal()][KerberosConstants.TGS_REQ_TAG] = new GrammarTransition(
-            TgsReqStatesEnum.START_STATE, TgsReqStatesEnum.TGS_REQ_STATE, KerberosConstants.TGS_REQ_TAG,
-            new StoreKdcReq() );
+        super.transitions[TgsReqStatesEnum.START_STATE.ordinal()][KerberosConstants.TGS_REQ_TAG] =
+            new GrammarTransition<TgsReqContainer>(
+                TgsReqStatesEnum.START_STATE,
+                TgsReqStatesEnum.TGS_REQ_STATE,
+                KerberosConstants.TGS_REQ_TAG,
+                new StoreKdcReq() );
     }
 
 
     /**
      * Get the instance of this grammar
-     * 
+     *
      * @return An instance on the AS-REQ Grammar
      */
-    public static Grammar getInstance()
+    public static Grammar<TgsReqContainer> getInstance()
     {
         return instance;
     }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsReq/TgsReqStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsReq/TgsReqStatesEnum.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsReq/TgsReqStatesEnum.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsReq/TgsReqStatesEnum.java Mon Feb  7 20:49:04 2011
@@ -6,46 +6,45 @@
  *  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.tgsReq;
 
 
 import org.apache.directory.shared.asn1.ber.grammar.Grammar;
 import org.apache.directory.shared.asn1.ber.grammar.States;
-import org.apache.directory.shared.kerberos.codec.tgsRep.TgsRepGrammar;
 
 
 /**
  * This class store the TGS-REQ grammar's constants. It is also used for debugging
  * purpose
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public enum TgsReqStatesEnum implements States
 {
     // Start
     START_STATE,                             // 0
-    
+
     // ----- TGS-REQ message --------------------------------------
     TGS_REQ_STATE,                           // 1
-    
+
     // End
     LAST_TGS_REQ_STATE;                      // 2
 
-    
+
     /**
      * Get the grammar name
-     * 
+     *
      * @param grammar The grammar code
      * @return The grammar name
      */
@@ -57,13 +56,13 @@ public enum TgsReqStatesEnum implements 
 
     /**
      * Get the grammar name
-     * 
+     *
      * @param grammar The grammar class
      * @return The grammar name
      */
-    public String getGrammarName( Grammar grammar )
+    public String getGrammarName( Grammar<TgsReqContainer> grammar )
     {
-        if ( grammar instanceof TgsRepGrammar )
+        if ( grammar instanceof TgsReqGrammar )
         {
             return "TGS_REQ_GRAMMAR";
         }
@@ -76,7 +75,7 @@ public enum TgsReqStatesEnum implements 
 
     /**
      * Get the string representing the state
-     * 
+     *
      * @param state The state number
      * @return The String representing the state
      */
@@ -85,7 +84,7 @@ public enum TgsReqStatesEnum implements 
         return ( ( state == LAST_TGS_REQ_STATE.ordinal() ) ? "TGS_REQ_END_STATE" : name() );
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
@@ -93,8 +92,8 @@ public enum TgsReqStatesEnum implements 
     {
         return this == LAST_TGS_REQ_STATE;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */



Mime
View raw message