directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1068124 [18/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/tgsReq/actions/StoreKdcReq.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsReq/actions/StoreKdcReq.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/actions/StoreKdcReq.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/tgsReq/actions/StoreKdcReq.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.tgsReq.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-REQ object
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreKdcReq extends GrammarAction
+public class StoreKdcReq extends GrammarAction<TgsReqContainer>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( StoreKdcReq.class );
@@ -60,10 +59,8 @@ public class StoreKdcReq extends Grammar
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    public void action( TgsReqContainer tgsReqContainer ) throws DecoderException
     {
-        TgsReqContainer tgsReqContainer = ( TgsReqContainer ) container;
-
         TLV tlv = tgsReqContainer.getCurrentTLV();
 
         // The Length should not be null
@@ -74,44 +71,44 @@ public class StoreKdcReq extends Grammar
             // This will generate a PROTOCOL_ERROR
             throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
         }
-        
+
         // Now, let's decode the KDC-REQ
         Asn1Decoder kdcReqDecoder = new Asn1Decoder();
-        
-        KdcReqContainer kdcReqContainer = new KdcReqContainer( container.getStream() );
-        
+
+        KdcReqContainer kdcReqContainer = new KdcReqContainer( tgsReqContainer.getStream() );
+
         // Store the created TGS-REQ object into the KDC-REQ container
         TgsReq tgsReq = new TgsReq();
         kdcReqContainer.setKdcReq( tgsReq );
-        
+
         // Decode the KDC_REQ PDU
         try
         {
-            kdcReqDecoder.decode( container.getStream(), kdcReqContainer );
+            kdcReqDecoder.decode( tgsReqContainer.getStream(), kdcReqContainer );
         }
         catch ( DecoderException de )
         {
             throw de;
         }
-        
+
         // Update the expected length for the current TLV
         tlv.setExpectedLength( tlv.getExpectedLength() - tlv.getLength() );
 
         // Update the parent
-        container.updateParent();
-        
+        tgsReqContainer.updateParent();
+
         if ( tgsReq.getMessageType() != KerberosMessageType.TGS_REQ )
         {
             throw new DecoderException( "Bad message type" );
         }
-        
+
         tgsReqContainer.setTgsReq( tgsReq );
 
         if ( IS_DEBUG )
         {
             LOG.debug( "TGS-REQ : {}", tgsReq );
         }
-        
-        container.setGrammarEndAllowed( true );
+
+        tgsReqContainer.setGrammarEndAllowed( true );
     }
 }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/TicketGrammar.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/TicketGrammar.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/TicketGrammar.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/TicketGrammar.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.ticket;
 
 
+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.ticket.actions.StoreEncPart;
 import org.apache.directory.shared.kerberos.codec.ticket.actions.StoreRealm;
@@ -37,18 +37,19 @@ import org.apache.directory.shared.kerbe
  * This class implements the Ticket message. 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 TicketGrammar extends AbstractGrammar
+public final class TicketGrammar extends AbstractGrammar<TicketContainer>
 {
     /** The instance of grammar. TicketGrammar is a singleton */
-    private static Grammar instance = new TicketGrammar();
+    private static Grammar<TicketContainer> instance = new TicketGrammar();
 
 
     /**
      * Creates a new TicketGrammar object.
      */
+    @SuppressWarnings("unchecked")
     private TicketGrammar()
     {
         setName( TicketGrammar.class.getName() );
@@ -57,113 +58,132 @@ public final class TicketGrammar extends
         super.transitions = new GrammarTransition[TicketStatesEnum.LAST_TICKET_STATE.ordinal()][256];
 
         // ============================================================================================
-        // Ticket 
+        // Ticket
         // ============================================================================================
         // --------------------------------------------------------------------------------------------
         // Transition from START to Ticket
         // --------------------------------------------------------------------------------------------
         // This is the starting state :
-        // Ticket          ::= [APPLICATION 1] ... 
-        super.transitions[TicketStatesEnum.START_STATE.ordinal()][KerberosConstants.TICKET_TAG] = new GrammarTransition(
-            TicketStatesEnum.START_STATE, TicketStatesEnum.TICKET_STATE, KerberosConstants.TICKET_TAG,
-            new TicketInit() );
+        // Ticket          ::= [APPLICATION 1] ...
+        super.transitions[TicketStatesEnum.START_STATE.ordinal()][KerberosConstants.TICKET_TAG] =
+            new GrammarTransition<TicketContainer>(
+                TicketStatesEnum.START_STATE,
+                TicketStatesEnum.TICKET_STATE,
+                KerberosConstants.TICKET_TAG,
+                new TicketInit() );
 
-        
         // --------------------------------------------------------------------------------------------
         // Transition from Ticket to Ticket-SEQ
         // --------------------------------------------------------------------------------------------
-        // Ticket          ::= [APPLICATION 1] SEQUENCE { 
-        super.transitions[TicketStatesEnum.TICKET_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            TicketStatesEnum.TICKET_STATE, TicketStatesEnum.TICKET_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
-            new CheckNotNullLength() );
+        // Ticket          ::= [APPLICATION 1] SEQUENCE {
+        super.transitions[TicketStatesEnum.TICKET_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+            new GrammarTransition<TicketContainer>(
+                TicketStatesEnum.TICKET_STATE,
+                TicketStatesEnum.TICKET_SEQ_STATE,
+                UniversalTag.SEQUENCE.getValue(),
+                new CheckNotNullLength<TicketContainer>() );
 
-        
         // --------------------------------------------------------------------------------------------
         // Transition from Ticket-SEQ to tkt-vno tag
         // --------------------------------------------------------------------------------------------
-        // Ticket          ::= [APPLICATION 1] SEQUENCE { 
-        //         tkt-vno         [0] 
-        super.transitions[TicketStatesEnum.TICKET_SEQ_STATE.ordinal()][KerberosConstants.TICKET_TKT_VNO_TAG] = new GrammarTransition(
-            TicketStatesEnum.TICKET_SEQ_STATE, TicketStatesEnum.TICKET_VNO_TAG_STATE, KerberosConstants.TICKET_TKT_VNO_TAG,
-            new CheckNotNullLength() );
+        // Ticket          ::= [APPLICATION 1] SEQUENCE {
+        //         tkt-vno         [0]
+        super.transitions[TicketStatesEnum.TICKET_SEQ_STATE.ordinal()][KerberosConstants.TICKET_TKT_VNO_TAG] =
+            new GrammarTransition<TicketContainer>(
+                TicketStatesEnum.TICKET_SEQ_STATE,
+                TicketStatesEnum.TICKET_VNO_TAG_STATE,
+                KerberosConstants.TICKET_TKT_VNO_TAG,
+                new CheckNotNullLength<TicketContainer>() );
 
-        
         // --------------------------------------------------------------------------------------------
-        // Transition from tkt-vno tag to tkt-vno 
+        // Transition from tkt-vno tag to tkt-vno
         // --------------------------------------------------------------------------------------------
-        // Ticket          ::= [APPLICATION 1] SEQUENCE { 
+        // Ticket          ::= [APPLICATION 1] SEQUENCE {
         //         tkt-vno         [0] INTEGER (5),
-        super.transitions[TicketStatesEnum.TICKET_VNO_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = new GrammarTransition(
-            TicketStatesEnum.TICKET_VNO_TAG_STATE, TicketStatesEnum.TICKET_VNO_STATE, UniversalTag.INTEGER.getValue(),
-            new StoreTktVno() );
+        super.transitions[TicketStatesEnum.TICKET_VNO_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] =
+            new GrammarTransition<TicketContainer>(
+                TicketStatesEnum.TICKET_VNO_TAG_STATE,
+                TicketStatesEnum.TICKET_VNO_STATE,
+                UniversalTag.INTEGER.getValue(),
+                new StoreTktVno() );
 
-        
         // --------------------------------------------------------------------------------------------
         // Transition from tkt-vno to realm tag
         // --------------------------------------------------------------------------------------------
-        // Ticket          ::= [APPLICATION 1] SEQUENCE { 
-        //         tkt-vno         [0] INTEGER (5), 
+        // Ticket          ::= [APPLICATION 1] SEQUENCE {
+        //         tkt-vno         [0] INTEGER (5),
         //         realm           [1]
-        super.transitions[TicketStatesEnum.TICKET_VNO_STATE.ordinal()][KerberosConstants.TICKET_REALM_TAG] = new GrammarTransition(
-            TicketStatesEnum.TICKET_VNO_STATE, TicketStatesEnum.TICKET_REALM_TAG_STATE, KerberosConstants.TICKET_REALM_TAG,
-            new CheckNotNullLength() );
+        super.transitions[TicketStatesEnum.TICKET_VNO_STATE.ordinal()][KerberosConstants.TICKET_REALM_TAG] =
+            new GrammarTransition<TicketContainer>(
+                TicketStatesEnum.TICKET_VNO_STATE,
+                TicketStatesEnum.TICKET_REALM_TAG_STATE,
+                KerberosConstants.TICKET_REALM_TAG,
+                new CheckNotNullLength<TicketContainer>() );
 
-        
         // --------------------------------------------------------------------------------------------
         // Transition from realm tag to realm value
         // --------------------------------------------------------------------------------------------
-        // Ticket          ::= [APPLICATION 1] SEQUENCE { 
+        // Ticket          ::= [APPLICATION 1] SEQUENCE {
         //         tkt-vno         [0] INTEGER (5),
         //         realm           [1] Realm,
-        super.transitions[TicketStatesEnum.TICKET_REALM_TAG_STATE.ordinal()][UniversalTag.GENERAL_STRING.getValue()] = new GrammarTransition(
-            TicketStatesEnum.TICKET_REALM_TAG_STATE, TicketStatesEnum.TICKET_REALM_STATE, UniversalTag.GENERAL_STRING.getValue(),
-            new StoreRealm() );
+        super.transitions[TicketStatesEnum.TICKET_REALM_TAG_STATE.ordinal()][UniversalTag.GENERAL_STRING.getValue()] =
+            new GrammarTransition<TicketContainer>(
+                TicketStatesEnum.TICKET_REALM_TAG_STATE,
+                TicketStatesEnum.TICKET_REALM_STATE,
+                UniversalTag.GENERAL_STRING.getValue(),
+                new StoreRealm() );
 
-        
         // --------------------------------------------------------------------------------------------
         // Transition from realm value to sname tag
         // --------------------------------------------------------------------------------------------
-        // Ticket          ::= [APPLICATION 1] SEQUENCE { 
+        // Ticket          ::= [APPLICATION 1] SEQUENCE {
         //         tkt-vno         [0] INTEGER (5),
         //         realm           [1] Realm,
-        //         sname           [2] 
-        super.transitions[TicketStatesEnum.TICKET_REALM_STATE.ordinal()][KerberosConstants.TICKET_SNAME_TAG] = new GrammarTransition(
-            TicketStatesEnum.TICKET_REALM_STATE, TicketStatesEnum.TICKET_SNAME_TAG_STATE, KerberosConstants.TICKET_SNAME_TAG,
-            new StoreSName() );
-
+        //         sname           [2]
+        super.transitions[TicketStatesEnum.TICKET_REALM_STATE.ordinal()][KerberosConstants.TICKET_SNAME_TAG] =
+            new GrammarTransition<TicketContainer>(
+                TicketStatesEnum.TICKET_REALM_STATE,
+                TicketStatesEnum.TICKET_SNAME_TAG_STATE,
+                KerberosConstants.TICKET_SNAME_TAG,
+                new StoreSName() );
 
         // --------------------------------------------------------------------------------------------
         // Transition from sname tag to enc-part tag
         // --------------------------------------------------------------------------------------------
-        // Ticket          ::= [APPLICATION 1] SEQUENCE { 
+        // Ticket          ::= [APPLICATION 1] SEQUENCE {
         //         ...
         //         sname           [2] PrincipalName,
         //         enc-part        [3]
-        // 
-        super.transitions[TicketStatesEnum.TICKET_SNAME_TAG_STATE.ordinal()][KerberosConstants.TICKET_ENC_PART_TAG] = new GrammarTransition(
-            TicketStatesEnum.TICKET_SNAME_TAG_STATE, TicketStatesEnum.TICKET_ENC_PART_TAG_STATE, KerberosConstants.TICKET_ENC_PART_TAG,
-            new CheckNotNullLength() );
+        //
+        super.transitions[TicketStatesEnum.TICKET_SNAME_TAG_STATE.ordinal()][KerberosConstants.TICKET_ENC_PART_TAG] =
+            new GrammarTransition<TicketContainer>(
+                TicketStatesEnum.TICKET_SNAME_TAG_STATE,
+                TicketStatesEnum.TICKET_ENC_PART_TAG_STATE,
+                KerberosConstants.TICKET_ENC_PART_TAG,
+                new CheckNotNullLength<TicketContainer>() );
 
-        
         // --------------------------------------------------------------------------------------------
         // Transition from enc-part tag to enc-part value
         // --------------------------------------------------------------------------------------------
-        // Ticket          ::= [APPLICATION 1] SEQUENCE { 
+        // Ticket          ::= [APPLICATION 1] SEQUENCE {
         //         ...
         //         enc-part        [3] EncryptedData
-        // 
-        super.transitions[TicketStatesEnum.TICKET_SNAME_TAG_STATE.ordinal()][KerberosConstants.TICKET_ENC_PART_TAG] = new GrammarTransition(
-            TicketStatesEnum.TICKET_SNAME_TAG_STATE, TicketStatesEnum.TICKET_ENC_PART_TAG_STATE, KerberosConstants.TICKET_ENC_PART_TAG,
-            new StoreEncPart() );
+        //
+        super.transitions[TicketStatesEnum.TICKET_SNAME_TAG_STATE.ordinal()][KerberosConstants.TICKET_ENC_PART_TAG] =
+            new GrammarTransition<TicketContainer>(
+                TicketStatesEnum.TICKET_SNAME_TAG_STATE,
+                TicketStatesEnum.TICKET_ENC_PART_TAG_STATE,
+                KerberosConstants.TICKET_ENC_PART_TAG,
+                new StoreEncPart() );
     }
 
 
     /**
      * Get the instance of this grammar
-     * 
+     *
      * @return An instance on the Ticket Grammar
      */
-    public static Grammar getInstance()
+    public static Grammar<TicketContainer> getInstance()
     {
         return instance;
     }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/TicketStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/TicketStatesEnum.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/TicketStatesEnum.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/TicketStatesEnum.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.ticket;
 
@@ -27,35 +27,35 @@ import org.apache.directory.shared.asn1.
 /**
  * This class store the Ticket grammar's constants. It is also used for debugging
  * purpose
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public enum TicketStatesEnum implements States
 {
     // Start
     START_STATE,                // 0
-    
+
     // ----- Ticket message --------------------------------------------
     TICKET_STATE,               // 1
     TICKET_SEQ_STATE,           // 2
-    
+
     TICKET_VNO_TAG_STATE,       // 3
     TICKET_VNO_STATE,           // 4
-    
+
     TICKET_REALM_TAG_STATE,     // 5
     TICKET_REALM_STATE,         // 6
-    
+
     TICKET_SNAME_TAG_STATE,     // 7
 
     TICKET_ENC_PART_TAG_STATE,  // 8
-    
+
     // End
     LAST_TICKET_STATE;          // 9
 
-    
+
     /**
      * Get the grammar name
-     * 
+     *
      * @param grammar The grammar code
      * @return The grammar name
      */
@@ -67,11 +67,11 @@ public enum TicketStatesEnum implements 
 
     /**
      * Get the grammar name
-     * 
+     *
      * @param grammar The grammar class
      * @return The grammar name
      */
-    public String getGrammarName( Grammar grammar )
+    public String getGrammarName( Grammar<TicketContainer> grammar )
     {
         if ( grammar instanceof TicketGrammar )
         {
@@ -86,7 +86,7 @@ public enum TicketStatesEnum implements 
 
     /**
      * Get the string representing the state
-     * 
+     *
      * @param state The state number
      * @return The String representing the state
      */
@@ -95,7 +95,7 @@ public enum TicketStatesEnum implements 
         return ( ( state == LAST_TICKET_STATE.ordinal() ) ? "TICKET_END_STATE" : name() );
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
@@ -103,8 +103,8 @@ public enum TicketStatesEnum implements 
     {
         return this == LAST_TICKET_STATE;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/actions/StoreEncPart.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/actions/StoreEncPart.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/actions/StoreEncPart.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/actions/StoreEncPart.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.ticket.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.kerberos.codec.actions.AbstractReadEncryptedPart;
 import org.apache.directory.shared.kerberos.codec.ticket.TicketContainer;
 import org.apache.directory.shared.kerberos.components.EncryptedData;
@@ -28,10 +27,10 @@ import org.apache.directory.shared.kerbe
 
 /**
  * The action used to set the ticket EncodedPart
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreEncPart extends AbstractReadEncryptedPart
+public class StoreEncPart extends AbstractReadEncryptedPart<TicketContainer>
 {
 
     /**
@@ -47,11 +46,10 @@ public class StoreEncPart extends Abstra
      * {@inheritDoc}
      */
     @Override
-    protected void setEncryptedData( EncryptedData encryptedData, Asn1Container container )
+    protected void setEncryptedData( EncryptedData encryptedData, TicketContainer ticketContainer )
     {
-        TicketContainer ticketContainer = ( TicketContainer ) container;
         ticketContainer.getTicket().setEncPart( encryptedData );
 
-        container.setGrammarEndAllowed( true );
+        ticketContainer.setGrammarEndAllowed( true );
     }
 }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/actions/StoreRealm.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/actions/StoreRealm.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/actions/StoreRealm.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/actions/StoreRealm.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.ticket.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.kerberos.codec.actions.AbstractReadRealm;
 import org.apache.directory.shared.kerberos.codec.ticket.TicketContainer;
 
 
 /**
  * The action used to set the ticket Realm
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreRealm extends AbstractReadRealm
+public class StoreRealm extends AbstractReadRealm<TicketContainer>
 {
     /**
      * Instantiates a new StoreRealm action.
@@ -45,9 +44,8 @@ public class StoreRealm extends Abstract
      * {@inheritDoc}
      */
     @Override
-    protected void setRealm( String realm, Asn1Container container )
+    protected void setRealm( String realm, TicketContainer ticketContainer )
     {
-        TicketContainer ticketContainer = ( TicketContainer ) container;
         ticketContainer.getTicket().setRealm( realm );
     }
 }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/actions/StoreSName.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/actions/StoreSName.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/actions/StoreSName.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/actions/StoreSName.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.ticket.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.kerberos.codec.actions.AbstractReadPrincipalName;
 import org.apache.directory.shared.kerberos.codec.ticket.TicketContainer;
 import org.apache.directory.shared.kerberos.components.PrincipalName;
@@ -28,10 +27,10 @@ import org.apache.directory.shared.kerbe
 
 /**
  * The action used to set the ticket SName
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreSName extends AbstractReadPrincipalName
+public class StoreSName extends AbstractReadPrincipalName<TicketContainer>
 {
     /**
      * Instantiates a new StoreSName action.
@@ -46,9 +45,8 @@ public class StoreSName extends Abstract
      * {@inheritDoc}
      */
     @Override
-    protected void setPrincipalName( PrincipalName principalName, Asn1Container container )
+    protected void setPrincipalName( PrincipalName principalName, TicketContainer ticketContainer )
     {
-        TicketContainer ticketContainer = ( TicketContainer ) container;
         ticketContainer.getTicket().setSName( principalName );
     }
 }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/actions/StoreTktVno.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/actions/StoreTktVno.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/actions/StoreTktVno.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/actions/StoreTktVno.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.ticket.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.asn1.actions.AbstractReadInteger;
 import org.apache.directory.shared.kerberos.codec.ticket.TicketContainer;
 
 
 /**
  * The action used to set the ticket VNO
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreTktVno extends AbstractReadInteger
+public class StoreTktVno extends AbstractReadInteger<TicketContainer>
 {
     /**
      * Instantiates a new TicketTktVno action.
@@ -45,9 +44,8 @@ public class StoreTktVno extends Abstrac
      * {@inheritDoc}
      */
     @Override
-    protected void setIntegerValue( int value, Asn1Container container )
+    protected void setIntegerValue( int value, TicketContainer ticketContainer )
     {
-        TicketContainer ticketContainer = ( TicketContainer ) container;
         ticketContainer.getTicket().setTktVno( value );
     }
 }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/actions/TicketInit.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/actions/TicketInit.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/actions/TicketInit.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/ticket/actions/TicketInit.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.ticket.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.DecoderException;
 import org.apache.directory.shared.kerberos.codec.ticket.TicketContainer;
 import org.apache.directory.shared.kerberos.messages.Ticket;
 import org.slf4j.Logger;
@@ -33,10 +32,10 @@ import org.slf4j.LoggerFactory;
 
 /**
  * The action used to initialize the Ticket object
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class TicketInit extends GrammarAction
+public class TicketInit extends GrammarAction<TicketContainer>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( TicketInit.class );
@@ -53,10 +52,8 @@ public class TicketInit extends GrammarA
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    public void action( TicketContainer ticketContainer ) throws DecoderException
     {
-        TicketContainer ticketContainer = ( TicketContainer ) container;
-
         TLV tlv = ticketContainer.getCurrentTLV();
 
         // The Length should not be null
@@ -67,10 +64,10 @@ public class TicketInit extends GrammarA
             // This will generate a PROTOCOL_ERROR
             throw new DecoderException( I18n.err( I18n.ERR_744_NULL_PDU_LENGTH ) );
         }
-        
+
         // Create the Ticket now
         Ticket ticket = new Ticket();
-        
+
         ticketContainer.setTicket( ticket );
     }
 }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/transitedEncoding/TransitedEncodingGrammar.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/transitedEncoding/TransitedEncodingGrammar.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/transitedEncoding/TransitedEncodingGrammar.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/transitedEncoding/TransitedEncodingGrammar.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.transitedEncoding;
 
 
+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.transitedEncoding.actions.StoreContents;
 import org.apache.directory.shared.kerberos.codec.transitedEncoding.actions.StoreTrType;
@@ -37,10 +37,10 @@ import org.slf4j.LoggerFactory;
  * This class implements the TransitedEncoding 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 TransitedEncodingGrammar extends AbstractGrammar
+public final class TransitedEncodingGrammar extends AbstractGrammar<TransitedEncodingContainer>
 {
     /** The logger */
     static final Logger LOG = LoggerFactory.getLogger( TransitedEncodingGrammar.class );
@@ -49,12 +49,13 @@ public final class TransitedEncodingGram
     static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     /** The instance of grammar. TransitedEncodingGrammar is a singleton */
-    private static Grammar instance = new TransitedEncodingGrammar();
+    private static Grammar<TransitedEncodingContainer> instance = new TransitedEncodingGrammar();
 
 
     /**
      * Creates a new TransitedEncodingGrammar object.
      */
+    @SuppressWarnings("unchecked")
     private TransitedEncodingGrammar()
     {
         setName( TransitedEncodingGrammar.class.getName() );
@@ -63,62 +64,79 @@ public final class TransitedEncodingGram
         super.transitions = new GrammarTransition[TransitedEncodingStatesEnum.LAST_TRANSITED_ENCODING_STATE.ordinal()][256];
 
         // ============================================================================================
-        // TransitedEncoding 
+        // TransitedEncoding
         // ============================================================================================
         // --------------------------------------------------------------------------------------------
         // Transition from TransitedEncoding init to TransitedEncoding SEQ
         // --------------------------------------------------------------------------------------------
         // TransitedEncoding   ::= SEQUENCE {
-        super.transitions[TransitedEncodingStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            TransitedEncodingStatesEnum.START_STATE, TransitedEncodingStatesEnum.TRANSITED_ENCODING_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
-            new TransitedEncodingInit() );
-        
+        super.transitions[TransitedEncodingStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+            new GrammarTransition<TransitedEncodingContainer>(
+                TransitedEncodingStatesEnum.START_STATE,
+                TransitedEncodingStatesEnum.TRANSITED_ENCODING_SEQ_STATE,
+                UniversalTag.SEQUENCE.getValue(),
+                new TransitedEncodingInit() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from TransitedEncoding SEQ to tr-type tag
         // --------------------------------------------------------------------------------------------
         // TransitedEncoding   ::= SEQUENCE {
         //         tr-type         [0]
-        super.transitions[TransitedEncodingStatesEnum.TRANSITED_ENCODING_SEQ_STATE.ordinal()][KerberosConstants.TRANSITED_ENCODING_TR_TYPE_TAG] = new GrammarTransition(
-            TransitedEncodingStatesEnum.TRANSITED_ENCODING_SEQ_STATE, TransitedEncodingStatesEnum.TRANSITED_ENCODING_TR_TYPE_TAG_STATE, KerberosConstants.TRANSITED_ENCODING_TR_TYPE_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[TransitedEncodingStatesEnum.TRANSITED_ENCODING_SEQ_STATE.ordinal()][KerberosConstants.TRANSITED_ENCODING_TR_TYPE_TAG] =
+            new GrammarTransition<TransitedEncodingContainer>(
+                TransitedEncodingStatesEnum.TRANSITED_ENCODING_SEQ_STATE,
+                TransitedEncodingStatesEnum.TRANSITED_ENCODING_TR_TYPE_TAG_STATE,
+                KerberosConstants.TRANSITED_ENCODING_TR_TYPE_TAG,
+                new CheckNotNullLength<TransitedEncodingContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from tr-type tag to tr-type value
         // --------------------------------------------------------------------------------------------
         // TransitedEncoding   ::= SEQUENCE {
         //         tr-type         [0] Int32 -- must be registered --,
-        super.transitions[TransitedEncodingStatesEnum.TRANSITED_ENCODING_TR_TYPE_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = new GrammarTransition(
-            TransitedEncodingStatesEnum.TRANSITED_ENCODING_TR_TYPE_TAG_STATE, TransitedEncodingStatesEnum.TRANSITED_ENCODING_TR_TYPE_STATE, UniversalTag.INTEGER.getValue(),
-            new StoreTrType() );
-        
+        super.transitions[TransitedEncodingStatesEnum.TRANSITED_ENCODING_TR_TYPE_TAG_STATE.ordinal()][UniversalTag.INTEGER
+            .getValue()] =
+            new GrammarTransition<TransitedEncodingContainer>(
+                TransitedEncodingStatesEnum.TRANSITED_ENCODING_TR_TYPE_TAG_STATE,
+                TransitedEncodingStatesEnum.TRANSITED_ENCODING_TR_TYPE_STATE,
+                UniversalTag.INTEGER.getValue(),
+                new StoreTrType() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from tr-type value to contents tag
         // --------------------------------------------------------------------------------------------
         // TransitedEncoding   ::= SEQUENCE {
         //         ...
-        //         contents        [1] 
-        super.transitions[TransitedEncodingStatesEnum.TRANSITED_ENCODING_TR_TYPE_STATE.ordinal()][KerberosConstants.TRANSITED_ENCODING_CONTENTS_TAG] = new GrammarTransition(
-            TransitedEncodingStatesEnum.TRANSITED_ENCODING_TR_TYPE_STATE, TransitedEncodingStatesEnum.TRANSITED_ENCODING_CONTENTS_TAG_STATE, KerberosConstants.TRANSITED_ENCODING_CONTENTS_TAG,
-            new CheckNotNullLength() );
-        
+        //         contents        [1]
+        super.transitions[TransitedEncodingStatesEnum.TRANSITED_ENCODING_TR_TYPE_STATE.ordinal()][KerberosConstants.TRANSITED_ENCODING_CONTENTS_TAG] =
+            new GrammarTransition<TransitedEncodingContainer>(
+                TransitedEncodingStatesEnum.TRANSITED_ENCODING_TR_TYPE_STATE,
+                TransitedEncodingStatesEnum.TRANSITED_ENCODING_CONTENTS_TAG_STATE,
+                KerberosConstants.TRANSITED_ENCODING_CONTENTS_TAG,
+                new CheckNotNullLength<TransitedEncodingContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from contents tag to contents value
         // --------------------------------------------------------------------------------------------
         // TransitedEncoding   ::= SEQUENCE {
         //         ...
         //         contents        [1] OCTET STRING
-        super.transitions[TransitedEncodingStatesEnum.TRANSITED_ENCODING_CONTENTS_TAG_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
-            TransitedEncodingStatesEnum.TRANSITED_ENCODING_CONTENTS_TAG_STATE, TransitedEncodingStatesEnum.TRANSITED_ENCODING_CONTENTS_STATE, UniversalTag.OCTET_STRING.getValue(),
-            new StoreContents() );
+        super.transitions[TransitedEncodingStatesEnum.TRANSITED_ENCODING_CONTENTS_TAG_STATE.ordinal()][UniversalTag.OCTET_STRING
+            .getValue()] =
+            new GrammarTransition<TransitedEncodingContainer>(
+                TransitedEncodingStatesEnum.TRANSITED_ENCODING_CONTENTS_TAG_STATE,
+                TransitedEncodingStatesEnum.TRANSITED_ENCODING_CONTENTS_STATE,
+                UniversalTag.OCTET_STRING.getValue(),
+                new StoreContents() );
     }
 
 
     /**
      * Get the instance of this grammar
-     * 
+     *
      * @return An instance on the TransitedEncoding Grammar
      */
-    public static Grammar getInstance()
+    public static Grammar<TransitedEncodingContainer> getInstance()
     {
         return instance;
     }

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

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/transitedEncoding/actions/StoreContents.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/transitedEncoding/actions/StoreContents.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/transitedEncoding/actions/StoreContents.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/transitedEncoding/actions/StoreContents.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.transitedEncoding.actions;
 
 
 import org.apache.directory.shared.asn1.actions.AbstractReadOctetString;
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.kerberos.codec.transitedEncoding.TransitedEncodingContainer;
 
 
 /**
  * The action used to read the TransitedEncoding contents
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreContents extends AbstractReadOctetString
+public class StoreContents extends AbstractReadOctetString<TransitedEncodingContainer>
 {
     /**
      * Instantiates a new StoreContents action.
@@ -45,10 +44,9 @@ public class StoreContents extends Abstr
      * {@inheritDoc}
      */
     @Override
-    protected void setOctetString( byte[] data, Asn1Container container )
+    protected void setOctetString( byte[] data, TransitedEncodingContainer transitedEncodingContainer )
     {
-        TransitedEncodingContainer transitedEncodingContainer = ( TransitedEncodingContainer ) container;
         transitedEncodingContainer.getTransitedEncoding().setContents( data );
-        container.setGrammarEndAllowed( true );
+        transitedEncodingContainer.setGrammarEndAllowed( true );
     }
 }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/transitedEncoding/actions/StoreTrType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/transitedEncoding/actions/StoreTrType.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/transitedEncoding/actions/StoreTrType.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/transitedEncoding/actions/StoreTrType.java Mon Feb  7 20:49:04 2011
@@ -6,32 +6,31 @@
  *  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.transitedEncoding.actions;
 
 
 import org.apache.directory.shared.asn1.actions.AbstractReadInteger;
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.kerberos.codec.transitedEncoding.TransitedEncodingContainer;
 import org.apache.directory.shared.kerberos.codec.types.TransitedEncodingType;
 
 
 /**
  * The action used to store the tr-type
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreTrType extends AbstractReadInteger
+public class StoreTrType extends AbstractReadInteger<TransitedEncodingContainer>
 {
 
     /**
@@ -47,9 +46,8 @@ public class StoreTrType extends Abstrac
      * {@inheritDoc}
      */
     @Override
-    protected void setIntegerValue( int value, Asn1Container container )
+    protected void setIntegerValue( int value, TransitedEncodingContainer transitedEncodingContainer )
     {
-        TransitedEncodingContainer transitedEncodingContainer = ( TransitedEncodingContainer ) container;
         TransitedEncodingType type = TransitedEncodingType.getTypeByOrdinal( value );
         transitedEncodingContainer.getTransitedEncoding().setTrType( type );
     }

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

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/typedData/TypedDataGrammar.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/typedData/TypedDataGrammar.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/typedData/TypedDataGrammar.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/typedData/TypedDataGrammar.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.typedData;
 
 
+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.typedData.actions.StoreDataValue;
 import org.apache.directory.shared.kerberos.codec.typedData.actions.StoreTdType;
@@ -37,10 +37,10 @@ import org.slf4j.LoggerFactory;
  * This class implements the TypedData 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 TypedDataGrammar extends AbstractGrammar
+public final class TypedDataGrammar extends AbstractGrammar<TypedDataContainer>
 {
     /** The logger */
     static final Logger LOG = LoggerFactory.getLogger( TypedDataGrammar.class );
@@ -49,12 +49,13 @@ public final class TypedDataGrammar exte
     static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     /** The instance of grammar. TypedDataGrammar is a singleton */
-    private static Grammar instance = new TypedDataGrammar();
+    private static Grammar<TypedDataContainer> instance = new TypedDataGrammar();
 
 
     /**
      * Creates a new TypedDataGrammar object.
      */
+    @SuppressWarnings("unchecked")
     private TypedDataGrammar()
     {
         setName( TypedDataGrammar.class.getName() );
@@ -63,71 +64,93 @@ public final class TypedDataGrammar exte
         super.transitions = new GrammarTransition[TypedDataStatesEnum.LAST_TYPED_DATA_STATE.ordinal()][256];
 
         // ============================================================================================
-        // TypedData 
+        // TypedData
         // ============================================================================================
         // --------------------------------------------------------------------------------------------
         // Transition from TypedData init to TypedData SEQ OF
         // --------------------------------------------------------------------------------------------
         // TypedData   ::= SEQUENCE OF
-        super.transitions[TypedDataStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            TypedDataStatesEnum.START_STATE, TypedDataStatesEnum.TYPED_DATA_SEQ_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
-            new TypedDataInit() );
-        
+        super.transitions[TypedDataStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+            new GrammarTransition<TypedDataContainer>(
+                TypedDataStatesEnum.START_STATE,
+                TypedDataStatesEnum.TYPED_DATA_SEQ_SEQ_STATE,
+                UniversalTag.SEQUENCE.getValue(),
+                new TypedDataInit() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from TypedData SEQ OF to SEQ
         // --------------------------------------------------------------------------------------------
         // TypedData  ::= SEQUENCE OF SEQUENCE {
-        super.transitions[TypedDataStatesEnum.TYPED_DATA_SEQ_SEQ_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            TypedDataStatesEnum.TYPED_DATA_SEQ_SEQ_STATE, TypedDataStatesEnum.TYPED_DATA_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
-            new CheckNotNullLength() );
-        
+        super.transitions[TypedDataStatesEnum.TYPED_DATA_SEQ_SEQ_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+            new GrammarTransition<TypedDataContainer>(
+                TypedDataStatesEnum.TYPED_DATA_SEQ_SEQ_STATE,
+                TypedDataStatesEnum.TYPED_DATA_SEQ_STATE,
+                UniversalTag.SEQUENCE.getValue(),
+                new CheckNotNullLength<TypedDataContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from TypedData SEQ OF to tdType tag
         // --------------------------------------------------------------------------------------------
         // TypedData  ::= SEQUENCE OF SEQUENCE {
         //         data-type     [0]
-        super.transitions[TypedDataStatesEnum.TYPED_DATA_SEQ_STATE.ordinal()][KerberosConstants.TYPED_DATA_TDTYPE_TAG] = new GrammarTransition(
-            TypedDataStatesEnum.TYPED_DATA_SEQ_STATE, TypedDataStatesEnum.TYPED_DATA_TDTYPE_TAG_STATE, KerberosConstants.TYPED_DATA_TDTYPE_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[TypedDataStatesEnum.TYPED_DATA_SEQ_STATE.ordinal()][KerberosConstants.TYPED_DATA_TDTYPE_TAG] =
+            new GrammarTransition<TypedDataContainer>(
+                TypedDataStatesEnum.TYPED_DATA_SEQ_STATE,
+                TypedDataStatesEnum.TYPED_DATA_TDTYPE_TAG_STATE,
+                KerberosConstants.TYPED_DATA_TDTYPE_TAG,
+                new CheckNotNullLength<TypedDataContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from adtype tag to tdtype value
         // --------------------------------------------------------------------------------------------
         // TypedData  ::= SEQUENCE OF SEQUENCE {
         //         data-type     [0] Int32,
-        super.transitions[TypedDataStatesEnum.TYPED_DATA_TDTYPE_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = new GrammarTransition(
-            TypedDataStatesEnum.TYPED_DATA_TDTYPE_TAG_STATE, TypedDataStatesEnum.TYPED_DATA_TDTYPE_STATE, UniversalTag.INTEGER.getValue(),
-            new StoreTdType() );
-        
+        super.transitions[TypedDataStatesEnum.TYPED_DATA_TDTYPE_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] =
+            new GrammarTransition<TypedDataContainer>(
+                TypedDataStatesEnum.TYPED_DATA_TDTYPE_TAG_STATE,
+                TypedDataStatesEnum.TYPED_DATA_TDTYPE_STATE,
+                UniversalTag.INTEGER.getValue(),
+                new StoreTdType() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from ad-type value to ad-data tag
         // --------------------------------------------------------------------------------------------
         // TypedData   ::= SEQUENCE OF SEQUENCE {
         //         ...
         //         data-value     [1]
-        super.transitions[TypedDataStatesEnum.TYPED_DATA_TDTYPE_STATE.ordinal()][KerberosConstants.TYPED_DATA_TDDATA_TAG] = new GrammarTransition(
-            TypedDataStatesEnum.TYPED_DATA_TDTYPE_STATE, TypedDataStatesEnum.TYPED_DATA_TDDATA_TAG_STATE, KerberosConstants.TYPED_DATA_TDDATA_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[TypedDataStatesEnum.TYPED_DATA_TDTYPE_STATE.ordinal()][KerberosConstants.TYPED_DATA_TDDATA_TAG] =
+            new GrammarTransition<TypedDataContainer>(
+                TypedDataStatesEnum.TYPED_DATA_TDTYPE_STATE,
+                TypedDataStatesEnum.TYPED_DATA_TDDATA_TAG_STATE,
+                KerberosConstants.TYPED_DATA_TDDATA_TAG,
+                new CheckNotNullLength<TypedDataContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from ad-data tag to ad-data value
         // --------------------------------------------------------------------------------------------
         // TypedData   ::= SEQUENCE OF SEQUENCE {
         //         ...
         //         data-value     [1] (OCTET STRING)
-        super.transitions[TypedDataStatesEnum.TYPED_DATA_TDDATA_TAG_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
-            TypedDataStatesEnum.TYPED_DATA_TDDATA_TAG_STATE, TypedDataStatesEnum.TYPED_DATA_TDDATA_STATE, UniversalTag.OCTET_STRING.getValue(),
-            new StoreDataValue() );
-        
+        super.transitions[TypedDataStatesEnum.TYPED_DATA_TDDATA_TAG_STATE.ordinal()][UniversalTag.OCTET_STRING
+            .getValue()] =
+            new GrammarTransition<TypedDataContainer>(
+                TypedDataStatesEnum.TYPED_DATA_TDDATA_TAG_STATE,
+                TypedDataStatesEnum.TYPED_DATA_TDDATA_STATE,
+                UniversalTag.OCTET_STRING.getValue(),
+                new StoreDataValue() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from ad-data value to SEQUENCE
         // --------------------------------------------------------------------------------------------
         // TypedData   ::= SEQUENCE {
         //         ...
         //         data-value     [1] (OCTET STRING)
-        super.transitions[TypedDataStatesEnum.TYPED_DATA_TDDATA_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            TypedDataStatesEnum.TYPED_DATA_TDDATA_STATE, TypedDataStatesEnum.TYPED_DATA_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
-            new CheckNotNullLength() );
+        super.transitions[TypedDataStatesEnum.TYPED_DATA_TDDATA_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+            new GrammarTransition<TypedDataContainer>(
+                TypedDataStatesEnum.TYPED_DATA_TDDATA_STATE,
+                TypedDataStatesEnum.TYPED_DATA_SEQ_STATE,
+                UniversalTag.SEQUENCE.getValue(),
+                new CheckNotNullLength<TypedDataContainer>() );
     }
 
 
@@ -136,10 +159,10 @@ public final class TypedDataGrammar exte
 
     /**
      * Get the instance of this grammar
-     * 
+     *
      * @return An instance on the TypedData Grammar
      */
-    public static Grammar getInstance()
+    public static Grammar<TypedDataContainer> getInstance()
     {
         return instance;
     }

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

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

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/typedData/actions/StoreTdType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/typedData/actions/StoreTdType.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/typedData/actions/StoreTdType.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/typedData/actions/StoreTdType.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.typedData.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.asn1.actions.AbstractReadInteger;
 import org.apache.directory.shared.kerberos.codec.typedData.TypedDataContainer;
 import org.apache.directory.shared.kerberos.components.TypedData;
@@ -28,10 +27,10 @@ import org.apache.directory.shared.kerbe
 
 /**
  * The action used to store the TypedData tdType
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreTdType extends AbstractReadInteger
+public class StoreTdType extends AbstractReadInteger<TypedDataContainer>
 {
     /**
      * Instantiates a new AuthorizationDataAdType action.
@@ -46,14 +45,12 @@ public class StoreTdType extends Abstrac
      * {@inheritDoc}
      */
     @Override
-    protected void setIntegerValue( int value, Asn1Container container )
+    protected void setIntegerValue( int value, TypedDataContainer typedDataContainer )
     {
-        TypedDataContainer typedDataContainer = ( TypedDataContainer ) container;
-        
         TypedData typedData = typedDataContainer.getTypedData();
         typedData.createNewTD();
         typedData.setCurrentDataType( value );
-        
-        container.setGrammarEndAllowed( true );
+
+        typedDataContainer.setGrammarEndAllowed( true );
     }
 }

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

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/flags/AbstractKerberosFlags.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/flags/AbstractKerberosFlags.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/flags/AbstractKerberosFlags.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/flags/AbstractKerberosFlags.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.flags;
 
@@ -25,12 +25,13 @@ import org.apache.directory.shared.asn1.
 /**
  * An implementation of a BitString for any KerberosFlags. The different values
  * are stored in an int, as there can't be more than 32 flags (TicketFlag).
- * 
+ *
  * Some basic operations are implemented in this abstract class, like those
  * manipulating flags.
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
+@SuppressWarnings("serial")
 public abstract class AbstractKerberosFlags extends BitString
 {
     /**
@@ -40,8 +41,8 @@ public abstract class AbstractKerberosFl
 
     /** The associated value */
     protected int value;
-    
-    
+
+
     /**
      * Standard constructor, which create a BitString containing 32 bits
      */
@@ -51,11 +52,11 @@ public abstract class AbstractKerberosFl
         value = 0;
     }
 
-    
+
     /**
      * Standard constructor, which create a BitString containing 32 bits
-     * 
-     * 
+     *
+     *
      * @param value The flags to store
      */
     public AbstractKerberosFlags( int value )
@@ -64,8 +65,8 @@ public abstract class AbstractKerberosFl
 
         setData( value );
     }
-    
-    
+
+
     /**
      * Store the flags contained in the given integer value
      * @param value The list of flags to set, as a int
@@ -73,36 +74,36 @@ public abstract class AbstractKerberosFl
     public void setData( int value )
     {
         byte[] bytes = new byte[5];
-        
+
         // The first byte contains the number of unused bytes, 0 here as we store 32 bits
         bytes[0] = 0;
-        
+
         bytes[1] = (byte)(value >> 24);
         bytes[3] = (byte)( (value >> 16) & 0x00FF );
         bytes[3] = (byte)( (value >> 8) & 0x00FF );
         bytes[4] = (byte)(value & 0x00FF);
-        
+
         super.setData( bytes );
         this.value = value;
     }
 
-    
+
     /**
      * Standard constructor, taking a byte array, 32 bits
      */
     public AbstractKerberosFlags( byte[] flags )
     {
         super( flags );
-        
+
         if ( ( flags == null ) || ( flags.length != 5 ) )
         {
             throw new IllegalArgumentException( "The given flags is not correct" );
         }
-        
+
         value = ( ( flags[1] & 0x00FF ) << 24 ) | ( ( flags[2] & 0x00FF ) << 16 ) | ( ( flags[3] & 0x00FF ) << 8 ) | ( 0x00FF & flags[4] );
     }
-    
-    
+
+
     /**
      * Returns the int value associated with the flags
      */
@@ -110,8 +111,8 @@ public abstract class AbstractKerberosFl
     {
         return value;
     }
-    
-    
+
+
     /**
      * Check if a flag is set
      * @param flags The flags to test
@@ -122,22 +123,22 @@ public abstract class AbstractKerberosFl
     {
         return ( flags & ( 1 << ( MAX_SIZE - 1 - flag ) ) ) != 0;
     }
-    
+
 
     /**
      * Check if a flag is set for the actual value
-     * 
+     *
      * @param flag The flag to check
      * @return True if the flag is set in the list of flags
      */
     public boolean isFlagSet( KerberosFlag flag )
     {
         int mask = 1 << ( MAX_SIZE - 1 - flag.getValue() );
-        
+
         return ( value & mask ) != 0;
     }
-    
-    
+
+
     /**
      * Check if a flag is set
      * @param flag The flags to test
@@ -147,11 +148,11 @@ public abstract class AbstractKerberosFl
     {
         return ( value & ( 1 << ( MAX_SIZE - 1 - flag ) ) ) != 0;
     }
-    
-    
+
+
     /**
      * Set a flag in a list of flags
-     * 
+     *
      * @param flag The flag to set
      */
     public void setFlag( KerberosFlag flag )
@@ -160,11 +161,11 @@ public abstract class AbstractKerberosFl
         setBit( flag.getValue() );
         value |= 1 << pos;
     }
-    
-    
+
+
     /**
      * Set a flag in a list of flags
-     * 
+     *
      * @param flag The flag to set
      */
     public void setFlag( int flag )
@@ -173,11 +174,11 @@ public abstract class AbstractKerberosFl
         setBit( flag );
         value |= 1 << pos;
     }
-    
+
 
     /**
      * clear a flag in a list of flags
-     * 
+     *
      * @param flag The flag to set
      */
     public void clearFlag( KerberosFlag flag )
@@ -186,11 +187,11 @@ public abstract class AbstractKerberosFl
         clearBit( flag.getValue() );
         value &= ~( 1 << pos );
     }
-    
-    
+
+
     /**
      * clear a flag in a list of flags
-     * 
+     *
      * @param flag The flag to set
      */
     public void clearFlag( int flag )
@@ -210,7 +211,7 @@ public abstract class AbstractKerberosFl
         return result;
     }
 
-    
+
     @Override
     public boolean equals( Object obj )
     {
@@ -218,14 +219,14 @@ public abstract class AbstractKerberosFl
         {
             return true;
         }
-        
+
         if ( obj == null )
         {
             return false;
         }
-        
+
         AbstractKerberosFlags other = ( AbstractKerberosFlags ) obj;
-        
+
         return value == other.value;
     }
 }



Mime
View raw message