directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1068124 [10/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/etypeInfo2Entry/actions/StoreEType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2Entry/actions/StoreEType.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2Entry/actions/StoreEType.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2Entry/actions/StoreEType.java Mon Feb  7 20:49:04 2011
@@ -6,27 +6,26 @@
  *  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.etypeInfo2Entry.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.asn1.ber.tlv.Value;
 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.i18n.I18n;
 import org.apache.directory.shared.kerberos.codec.etypeInfo2Entry.ETypeInfo2EntryContainer;
 import org.apache.directory.shared.kerberos.codec.types.EncryptionType;
@@ -38,10 +37,10 @@ import org.slf4j.LoggerFactory;
 
 /**
  * The action used to store the ETYPE-INFO2-ENTRY etype
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreEType extends GrammarAction
+public class StoreEType extends GrammarAction<ETypeInfo2EntryContainer>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( StoreEType.class );
@@ -62,11 +61,9 @@ public class StoreEType extends GrammarA
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    public void action( ETypeInfo2EntryContainer eTypeInfo2EntryContainer ) throws DecoderException
     {
-        ETypeInfo2EntryContainer etypeInfo2EntryContainer = ( ETypeInfo2EntryContainer ) container;
-
-        TLV tlv = etypeInfo2EntryContainer.getCurrentTLV();
+        TLV tlv = eTypeInfo2EntryContainer.getCurrentTLV();
 
         // The Length should not be null
         if ( tlv.getLength() == 0 )
@@ -76,13 +73,13 @@ public class StoreEType extends GrammarA
             // This will generate a PROTOCOL_ERROR
             throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
         }
-        
+
         // The etype is an integer
         Value value = tlv.getValue();
-        
+
         EncryptionType etype = null;
-        ETypeInfo2Entry etypeInfo2Entry = etypeInfo2EntryContainer.getETypeInfo2Entry();
-        
+        ETypeInfo2Entry etypeInfo2Entry = eTypeInfo2EntryContainer.getETypeInfo2Entry();
+
         try
         {
             int eType = IntegerDecoder.parse( value );
@@ -96,7 +93,7 @@ public class StoreEType extends GrammarA
             }
 
             // The next tag is optional, we can end here
-            etypeInfo2EntryContainer.setGrammarEndAllowed( true );
+            eTypeInfo2EntryContainer.setGrammarEndAllowed( true );
         }
         catch ( IntegerDecoderException ide )
         {

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2Entry/actions/StoreS2KParams.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2Entry/actions/StoreS2KParams.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2Entry/actions/StoreS2KParams.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2Entry/actions/StoreS2KParams.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.etypeInfo2Entry.actions;
 
 
 import org.apache.directory.shared.asn1.actions.AbstractReadOctetString;
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.kerberos.codec.etypeInfo2Entry.ETypeInfo2EntryContainer;
 
 
 /**
  * The action used to store the ETYPE-INFO2-ENTRY s2kparams
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreS2KParams extends AbstractReadOctetString
+public class StoreS2KParams extends AbstractReadOctetString<ETypeInfo2EntryContainer>
 {
     /**
      * Instantiates a new StoreS2KParams action.
@@ -45,10 +44,9 @@ public class StoreS2KParams extends Abst
      * {@inheritDoc}
      */
     @Override
-    protected void setOctetString( byte[] data, Asn1Container container )
+    protected void setOctetString( byte[] data, ETypeInfo2EntryContainer eTypeInfo2EntryContainer )
     {
-        ETypeInfo2EntryContainer etypeInfo2EntryContainer = ( ETypeInfo2EntryContainer ) container;
-        etypeInfo2EntryContainer.getETypeInfo2Entry().setS2kparams( data );
-        etypeInfo2EntryContainer.setGrammarEndAllowed( true );
+        eTypeInfo2EntryContainer.getETypeInfo2Entry().setS2kparams( data );
+        eTypeInfo2EntryContainer.setGrammarEndAllowed( true );
     }
 }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2Entry/actions/StoreSalt.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2Entry/actions/StoreSalt.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2Entry/actions/StoreSalt.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2Entry/actions/StoreSalt.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.etypeInfo2Entry.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
+import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
-import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.kerberos.codec.etypeInfo2Entry.ETypeInfo2EntryContainer;
 import org.apache.directory.shared.kerberos.components.ETypeInfo2Entry;
 import org.apache.directory.shared.util.Strings;
@@ -34,10 +33,10 @@ import org.slf4j.LoggerFactory;
 
 /**
  * The action used to store the ETYPE-INFO2-ENTRY cipher
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreSalt extends GrammarAction
+public class StoreSalt extends GrammarAction<ETypeInfo2EntryContainer>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( StoreSalt.class );
@@ -58,32 +57,30 @@ public class StoreSalt extends GrammarAc
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    public void action( ETypeInfo2EntryContainer eTypeInfo2EntryContainer ) throws DecoderException
     {
-        ETypeInfo2EntryContainer etypeInfo2EntryContainer = ( ETypeInfo2EntryContainer ) container;
-
-        TLV tlv = etypeInfo2EntryContainer.getCurrentTLV();
-        ETypeInfo2Entry etypeInfo2Entry = etypeInfo2EntryContainer.getETypeInfo2Entry();
+        TLV tlv = eTypeInfo2EntryContainer.getCurrentTLV();
+        ETypeInfo2Entry etypeInfo2Entry = eTypeInfo2EntryContainer.getETypeInfo2Entry();
 
         // The Length may be null
-        if ( tlv.getLength() != 0 ) 
+        if ( tlv.getLength() != 0 )
         {
             Value value = tlv.getValue();
-            
+
             // The encrypted data may be null
-            if ( value.getData() != null ) 
+            if ( value.getData() != null )
             {
                 String salt = Strings.utf8ToString(value.getData());
                 etypeInfo2Entry.setSalt( salt );
             }
         }
-        
+
         if ( IS_DEBUG )
         {
             LOG.debug( "salt : {}", etypeInfo2Entry.getSalt() );
         }
-        
+
         // We can end here
-        etypeInfo2EntryContainer.setGrammarEndAllowed( true );
+        eTypeInfo2EntryContainer.setGrammarEndAllowed( true );
     }
 }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfoEntry/ETypeInfoEntryGrammar.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfoEntry/ETypeInfoEntryGrammar.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfoEntry/ETypeInfoEntryGrammar.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfoEntry/ETypeInfoEntryGrammar.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.etypeInfoEntry;
 
 
+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.etypeInfoEntry.actions.ETypeInfoEntryInit;
 import org.apache.directory.shared.kerberos.codec.etypeInfoEntry.actions.StoreEType;
@@ -37,10 +37,10 @@ import org.slf4j.LoggerFactory;
  * This class implements the ETYPE-INFO-ENTRY 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 ETypeInfoEntryGrammar extends AbstractGrammar
+public final class ETypeInfoEntryGrammar extends AbstractGrammar<ETypeInfoEntryContainer>
 {
     /** The logger */
     static final Logger LOG = LoggerFactory.getLogger( ETypeInfoEntryGrammar.class );
@@ -49,12 +49,13 @@ public final class ETypeInfoEntryGrammar
     static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     /** The instance of grammar. ETypeInfoEntryGrammar is a singleton */
-    private static Grammar instance = new ETypeInfoEntryGrammar();
+    private static Grammar<ETypeInfoEntryContainer> instance = new ETypeInfoEntryGrammar();
 
 
     /**
      * Creates a new ETypeInfoEntryGrammar object.
      */
+    @SuppressWarnings("unchecked")
     private ETypeInfoEntryGrammar()
     {
         setName( ETypeInfoEntryGrammar.class.getName() );
@@ -63,62 +64,79 @@ public final class ETypeInfoEntryGrammar
         super.transitions = new GrammarTransition[ETypeInfoEntryStatesEnum.LAST_ETYPE_INFO_ENTRY_STATE.ordinal()][256];
 
         // ============================================================================================
-        // ETYPE-INFO-ENTRY 
+        // ETYPE-INFO-ENTRY
         // ============================================================================================
         // --------------------------------------------------------------------------------------------
         // Transition from ETYPE-INFO-ENTRY init to ETYPE-INFO-ENTRY SEQ
         // --------------------------------------------------------------------------------------------
         // ETYPE-INFO-ENTRY         ::= SEQUENCE {
-        super.transitions[ETypeInfoEntryStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            ETypeInfoEntryStatesEnum.START_STATE, ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
-            new ETypeInfoEntryInit() );
-        
+        super.transitions[ETypeInfoEntryStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+            new GrammarTransition<ETypeInfoEntryContainer>(
+                ETypeInfoEntryStatesEnum.START_STATE,
+                ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_SEQ_STATE,
+                UniversalTag.SEQUENCE.getValue(),
+                new ETypeInfoEntryInit() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from ETYPE-INFO-ENTRY SEQ to etype tag
         // --------------------------------------------------------------------------------------------
         // ETYPE-INFO-ENTRY         ::= SEQUENCE {
         //         etype           [0]
-        super.transitions[ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_SEQ_STATE.ordinal()][KerberosConstants.TRANSITED_ENCODING_TR_TYPE_TAG] = new GrammarTransition(
-            ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_SEQ_STATE, ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_ETYPE_TAG_STATE, KerberosConstants.TRANSITED_ENCODING_TR_TYPE_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_SEQ_STATE.ordinal()][KerberosConstants.TRANSITED_ENCODING_TR_TYPE_TAG] =
+            new GrammarTransition<ETypeInfoEntryContainer>(
+                ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_SEQ_STATE,
+                ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_ETYPE_TAG_STATE,
+                KerberosConstants.TRANSITED_ENCODING_TR_TYPE_TAG,
+                new CheckNotNullLength<ETypeInfoEntryContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from etype tag to etype value
         // --------------------------------------------------------------------------------------------
         // ETYPE-INFO-ENTRY         ::= SEQUENCE {
         //         etype           [0] Int32,
-        super.transitions[ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_ETYPE_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = new GrammarTransition(
-            ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_ETYPE_TAG_STATE, ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_ETYPE_STATE, UniversalTag.INTEGER.getValue(),
-            new StoreEType() );
-        
+        super.transitions[ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_ETYPE_TAG_STATE.ordinal()][UniversalTag.INTEGER
+            .getValue()] =
+            new GrammarTransition<ETypeInfoEntryContainer>(
+                ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_ETYPE_TAG_STATE,
+                ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_ETYPE_STATE,
+                UniversalTag.INTEGER.getValue(),
+                new StoreEType() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from etype value to salt tag
         // --------------------------------------------------------------------------------------------
         // ETYPE-INFO-ENTRY         ::= SEQUENCE {
         //         ...
         //         salt            [1]
-        super.transitions[ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_ETYPE_STATE.ordinal()][KerberosConstants.TRANSITED_ENCODING_CONTENTS_TAG] = new GrammarTransition(
-            ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_ETYPE_STATE, ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_SALT_TAG_STATE, KerberosConstants.TRANSITED_ENCODING_CONTENTS_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_ETYPE_STATE.ordinal()][KerberosConstants.TRANSITED_ENCODING_CONTENTS_TAG] =
+            new GrammarTransition<ETypeInfoEntryContainer>(
+                ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_ETYPE_STATE,
+                ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_SALT_TAG_STATE,
+                KerberosConstants.TRANSITED_ENCODING_CONTENTS_TAG,
+                new CheckNotNullLength<ETypeInfoEntryContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from salt tag to salt value
         // --------------------------------------------------------------------------------------------
         // ETYPE-INFO-ENTRY         ::= SEQUENCE {
         //         ...
         //         salt            [1] OCTET STRING OPTIONAL
-        super.transitions[ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_SALT_TAG_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
-            ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_SALT_TAG_STATE, ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_SALT_STATE, UniversalTag.OCTET_STRING.getValue(),
-            new StoreSalt() );
+        super.transitions[ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_SALT_TAG_STATE.ordinal()][UniversalTag.OCTET_STRING
+            .getValue()] =
+            new GrammarTransition<ETypeInfoEntryContainer>(
+                ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_SALT_TAG_STATE,
+                ETypeInfoEntryStatesEnum.ETYPE_INFO_ENTRY_SALT_STATE,
+                UniversalTag.OCTET_STRING.getValue(),
+                new StoreSalt() );
     }
 
 
     /**
      * Get the instance of this grammar
-     * 
+     *
      * @return An instance on the ETYPE-INFO-ENTRY Grammar
      */
-    public static Grammar getInstance()
+    public static Grammar<ETypeInfoEntryContainer> getInstance()
     {
         return instance;
     }

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

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

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfoEntry/actions/StoreEType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfoEntry/actions/StoreEType.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfoEntry/actions/StoreEType.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfoEntry/actions/StoreEType.java Mon Feb  7 20:49:04 2011
@@ -6,27 +6,26 @@
  *  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.etypeInfoEntry.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.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.etypeInfoEntry.ETypeInfoEntryContainer;
 import org.apache.directory.shared.kerberos.codec.types.EncryptionType;
@@ -38,10 +37,10 @@ import org.slf4j.LoggerFactory;
 
 /**
  * The action used to store the ETYPE-INFO-ENTRY etype
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreEType extends GrammarAction
+public class StoreEType extends GrammarAction<ETypeInfoEntryContainer>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( StoreEType.class );
@@ -62,11 +61,9 @@ public class StoreEType extends GrammarA
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    public void action( ETypeInfoEntryContainer eTypeInfoEntryContainer ) throws DecoderException
     {
-        ETypeInfoEntryContainer etypeInfoEntryContainer = ( ETypeInfoEntryContainer ) container;
-
-        TLV tlv = etypeInfoEntryContainer.getCurrentTLV();
+        TLV tlv = eTypeInfoEntryContainer.getCurrentTLV();
 
         // The Length should not be null
         if ( tlv.getLength() == 0 )
@@ -76,13 +73,13 @@ public class StoreEType extends GrammarA
             // This will generate a PROTOCOL_ERROR
             throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
         }
-        
+
         // The etype is an integer
         Value value = tlv.getValue();
-        
+
         EncryptionType etype = null;
-        ETypeInfoEntry etypeInfoEntry = etypeInfoEntryContainer.getETypeInfoEntry();
-        
+        ETypeInfoEntry etypeInfoEntry = eTypeInfoEntryContainer.getETypeInfoEntry();
+
         try
         {
             int eType = IntegerDecoder.parse(value);
@@ -96,7 +93,7 @@ public class StoreEType extends GrammarA
             }
 
             // The next tag is optional, we can end here
-            etypeInfoEntryContainer.setGrammarEndAllowed( true );
+            eTypeInfoEntryContainer.setGrammarEndAllowed( true );
         }
         catch ( IntegerDecoderException ide )
         {

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfoEntry/actions/StoreSalt.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfoEntry/actions/StoreSalt.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfoEntry/actions/StoreSalt.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfoEntry/actions/StoreSalt.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.etypeInfoEntry.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.asn1.actions.AbstractReadOctetString;
 import org.apache.directory.shared.kerberos.codec.etypeInfoEntry.ETypeInfoEntryContainer;
 
 
 /**
  * The action used to store the ETYPE-INFO-ENTRY cipher
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreSalt extends AbstractReadOctetString
+public class StoreSalt extends AbstractReadOctetString<ETypeInfoEntryContainer>
 {
     /**
      * Instantiates a new StoreSalt action.
@@ -45,10 +44,9 @@ public class StoreSalt extends AbstractR
      * {@inheritDoc}
      */
     @Override
-    protected void setOctetString( byte[] data, Asn1Container container )
+    protected void setOctetString( byte[] data, ETypeInfoEntryContainer eTypeInfoEntryContainer )
     {
-        ETypeInfoEntryContainer etypeInfoEntryContainer = ( ETypeInfoEntryContainer ) container;
-        etypeInfoEntryContainer.getETypeInfoEntry().setSalt( data );
-        etypeInfoEntryContainer.setGrammarEndAllowed( true );
+        eTypeInfoEntryContainer.getETypeInfoEntry().setSalt( data );
+        eTypeInfoEntryContainer.setGrammarEndAllowed( true );
     }
 }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/hostAddress/HostAddressGrammar.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/hostAddress/HostAddressGrammar.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/hostAddress/HostAddressGrammar.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/hostAddress/HostAddressGrammar.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.hostAddress;
 
@@ -37,10 +37,10 @@ import org.slf4j.LoggerFactory;
  * This class implements the HostAddress 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 HostAddressGrammar extends AbstractGrammar
+public final class HostAddressGrammar extends AbstractGrammar<HostAddressContainer>
 {
     /** The logger */
     static final Logger LOG = LoggerFactory.getLogger( HostAddressGrammar.class );
@@ -49,12 +49,13 @@ public final class HostAddressGrammar ex
     static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     /** The instance of grammar. HostAddressGrammar is a singleton */
-    private static Grammar instance = new HostAddressGrammar();
+    private static Grammar<HostAddressContainer> instance = new HostAddressGrammar();
 
 
     /**
      * Creates a new HostAddressGrammar object.
      */
+    @SuppressWarnings("unchecked")
     private HostAddressGrammar()
     {
         setName( HostAddressGrammar.class.getName() );
@@ -63,62 +64,79 @@ public final class HostAddressGrammar ex
         super.transitions = new GrammarTransition[HostAddressStatesEnum.LAST_HOST_ADDRESS_STATE.ordinal()][256];
 
         // ============================================================================================
-        // HostAddress 
+        // HostAddress
         // ============================================================================================
         // --------------------------------------------------------------------------------------------
         // Transition from HostAddress init to HostAddress SEQ
         // --------------------------------------------------------------------------------------------
         // HostAddress   ::= SEQUENCE
-        super.transitions[HostAddressStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            HostAddressStatesEnum.START_STATE, HostAddressStatesEnum.HOST_ADDRESS_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
-            new HostAddressInit() );
-        
+        super.transitions[HostAddressStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+            new GrammarTransition<HostAddressContainer>(
+                HostAddressStatesEnum.START_STATE,
+                HostAddressStatesEnum.HOST_ADDRESS_SEQ_STATE,
+                UniversalTag.SEQUENCE.getValue(),
+                new HostAddressInit() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from HostAddress SEQ to addr-type tag
         // --------------------------------------------------------------------------------------------
         // HostAddress   ::= SEQUENCE
         //         addr-type       [0]
-        super.transitions[HostAddressStatesEnum.HOST_ADDRESS_SEQ_STATE.ordinal()][KerberosConstants.HOST_ADDRESS_ADDR_TYPE_TAG] = new GrammarTransition(
-            HostAddressStatesEnum.HOST_ADDRESS_SEQ_STATE, HostAddressStatesEnum.HOST_ADDRESS_ADDR_TYPE_TAG_STATE, KerberosConstants.HOST_ADDRESS_ADDR_TYPE_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[HostAddressStatesEnum.HOST_ADDRESS_SEQ_STATE.ordinal()][KerberosConstants.HOST_ADDRESS_ADDR_TYPE_TAG] =
+            new GrammarTransition<HostAddressContainer>(
+                HostAddressStatesEnum.HOST_ADDRESS_SEQ_STATE,
+                HostAddressStatesEnum.HOST_ADDRESS_ADDR_TYPE_TAG_STATE,
+                KerberosConstants.HOST_ADDRESS_ADDR_TYPE_TAG,
+                new CheckNotNullLength<HostAddressContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from addr-type tag to addr-type value
         // --------------------------------------------------------------------------------------------
         // HostAddress   ::= SEQUENCE
         //         addr-type       [0] Int32,
-        super.transitions[HostAddressStatesEnum.HOST_ADDRESS_ADDR_TYPE_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = new GrammarTransition(
-            HostAddressStatesEnum.HOST_ADDRESS_ADDR_TYPE_TAG_STATE, HostAddressStatesEnum.HOST_ADDRESS_ADDR_TYPE_STATE, UniversalTag.INTEGER.getValue(),
-            new StoreAddrType() );
-        
+        super.transitions[HostAddressStatesEnum.HOST_ADDRESS_ADDR_TYPE_TAG_STATE.ordinal()][UniversalTag.INTEGER
+            .getValue()] =
+            new GrammarTransition<HostAddressContainer>(
+                HostAddressStatesEnum.HOST_ADDRESS_ADDR_TYPE_TAG_STATE,
+                HostAddressStatesEnum.HOST_ADDRESS_ADDR_TYPE_STATE,
+                UniversalTag.INTEGER.getValue(),
+                new StoreAddrType() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from addr-type value to address tag
         // --------------------------------------------------------------------------------------------
         // HostAddress   ::= SEQUENCE
         //         ...
         //         address         [1]
-        super.transitions[HostAddressStatesEnum.HOST_ADDRESS_ADDR_TYPE_STATE.ordinal()][KerberosConstants.HOST_ADDRESS_ADDRESS_TAG] = new GrammarTransition(
-            HostAddressStatesEnum.HOST_ADDRESS_ADDR_TYPE_STATE, HostAddressStatesEnum.HOST_ADDRESS_ADDRESS_TAG_STATE, KerberosConstants.HOST_ADDRESS_ADDRESS_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[HostAddressStatesEnum.HOST_ADDRESS_ADDR_TYPE_STATE.ordinal()][KerberosConstants.HOST_ADDRESS_ADDRESS_TAG] =
+            new GrammarTransition<HostAddressContainer>(
+                HostAddressStatesEnum.HOST_ADDRESS_ADDR_TYPE_STATE,
+                HostAddressStatesEnum.HOST_ADDRESS_ADDRESS_TAG_STATE,
+                KerberosConstants.HOST_ADDRESS_ADDRESS_TAG,
+                new CheckNotNullLength<HostAddressContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from address tag to address value
         // --------------------------------------------------------------------------------------------
         // HostAddress   ::= SEQUENCE
         //         ...
         //         address         [1] OCTET STRING
-        super.transitions[HostAddressStatesEnum.HOST_ADDRESS_ADDRESS_TAG_STATE.ordinal()][UniversalTag.OCTET_STRING.ordinal()] = new GrammarTransition(
-            HostAddressStatesEnum.HOST_ADDRESS_ADDRESS_TAG_STATE, HostAddressStatesEnum.HOST_ADDRESS_ADDRESS_STATE, UniversalTag.OCTET_STRING.ordinal(),
-            new StoreAddress() );
+        super.transitions[HostAddressStatesEnum.HOST_ADDRESS_ADDRESS_TAG_STATE.ordinal()][UniversalTag.OCTET_STRING
+            .ordinal()] =
+            new GrammarTransition<HostAddressContainer>(
+                HostAddressStatesEnum.HOST_ADDRESS_ADDRESS_TAG_STATE,
+                HostAddressStatesEnum.HOST_ADDRESS_ADDRESS_STATE,
+                UniversalTag.OCTET_STRING.ordinal(),
+                new StoreAddress() );
     }
 
 
     /**
      * Get the instance of this grammar
-     * 
+     *
      * @return An instance on the HostAddress Grammar
      */
-    public static Grammar getInstance()
+    public static Grammar<HostAddressContainer> getInstance()
     {
         return instance;
     }

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

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

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/hostAddress/actions/StoreAddrType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/hostAddress/actions/StoreAddrType.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/hostAddress/actions/StoreAddrType.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/hostAddress/actions/StoreAddrType.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.hostAddress.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.asn1.actions.AbstractReadInteger;
 import org.apache.directory.shared.kerberos.codec.hostAddress.HostAddressContainer;
 import org.apache.directory.shared.kerberos.codec.types.HostAddrType;
@@ -31,10 +30,10 @@ import org.slf4j.LoggerFactory;
 
 /**
  * The action used to initialize the HostAddress object
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreAddrType extends AbstractReadInteger
+public class StoreAddrType extends AbstractReadInteger<HostAddressContainer>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( StoreAddrType.class );
@@ -55,14 +54,13 @@ public class StoreAddrType extends Abstr
      * {@inheritDoc}
      */
     @Override
-    protected void setIntegerValue( int value, Asn1Container container )
+    protected void setIntegerValue( int value, HostAddressContainer hostAddressContainer )
     {
-        HostAddressContainer hostAddressContainer = ( HostAddressContainer ) container;
         HostAddress hostAddressData = hostAddressContainer.getHostAddress();
-        
+
         HostAddrType hostAddrType = HostAddrType.getTypeByOrdinal( value );
         hostAddressData.setAddrType( hostAddrType );
-        
+
         if ( IS_DEBUG )
         {
             LOG.debug( "addr-type : {}", hostAddrType );

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/hostAddress/actions/StoreAddress.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/hostAddress/actions/StoreAddress.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/hostAddress/actions/StoreAddress.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/hostAddress/actions/StoreAddress.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.hostAddress.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.asn1.actions.AbstractReadOctetString;
 import org.apache.directory.shared.kerberos.codec.hostAddress.HostAddressContainer;
 import org.apache.directory.shared.util.Strings;
@@ -30,10 +29,10 @@ import org.slf4j.LoggerFactory;
 
 /**
  * The action used to add the HostAddress address value
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreAddress extends AbstractReadOctetString
+public class StoreAddress extends AbstractReadOctetString<HostAddressContainer>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( StoreAddress.class );
@@ -54,12 +53,11 @@ public class StoreAddress extends Abstra
      * {@inheritDoc}
      */
     @Override
-    protected void setOctetString( byte[] data, Asn1Container container )
+    protected void setOctetString( byte[] data, HostAddressContainer hostAddressContainer )
     {
-        HostAddressContainer hostAddressContainer = ( HostAddressContainer ) container;
         hostAddressContainer.getHostAddress().setAddress( data );
-        container.setGrammarEndAllowed( true );
-        
+        hostAddressContainer.setGrammarEndAllowed( true );
+
         if ( IS_DEBUG )
         {
             LOG.debug( "Address : {}", Strings.utf8ToString(data) );

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/hostAddresses/HostAddressesGrammar.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/hostAddresses/HostAddressesGrammar.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/hostAddresses/HostAddressesGrammar.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/hostAddresses/HostAddressesGrammar.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.hostAddresses;
 
@@ -34,10 +34,10 @@ import org.slf4j.LoggerFactory;
  * This class implements the HostAddresses 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 HostAddressesGrammar extends AbstractGrammar
+public final class HostAddressesGrammar extends AbstractGrammar<HostAddressesContainer>
 {
     /** The logger */
     static final Logger LOG = LoggerFactory.getLogger( HostAddressesGrammar.class );
@@ -46,12 +46,13 @@ public final class HostAddressesGrammar 
     static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     /** The instance of grammar. HostAddressesGrammar is a singleton */
-    private static Grammar instance = new HostAddressesGrammar();
+    private static Grammar<HostAddressesContainer> instance = new HostAddressesGrammar();
 
 
     /**
      * Creates a new HostAddressGrammar object.
      */
+    @SuppressWarnings("unchecked")
     private HostAddressesGrammar()
     {
         setName( HostAddressesGrammar.class.getName() );
@@ -60,24 +61,31 @@ public final class HostAddressesGrammar 
         super.transitions = new GrammarTransition[HostAddressesStatesEnum.LAST_HOST_ADDRESSES_STATE.ordinal()][256];
 
         // ============================================================================================
-        // HostAddresses 
+        // HostAddresses
         // ============================================================================================
         // --------------------------------------------------------------------------------------------
         // Transition from HostAddresses init to HostAddresses SEQUENCE OF
         // --------------------------------------------------------------------------------------------
         // HostAddress   ::= SEQUENCE OF
-        super.transitions[HostAddressesStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            HostAddressesStatesEnum.START_STATE, HostAddressesStatesEnum.HOST_ADDRESSES_ADDRESS_STATE, UniversalTag.SEQUENCE.getValue(),
-            new CheckNotNullLength() );
-        
+        super.transitions[HostAddressesStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+            new GrammarTransition<HostAddressesContainer>(
+                HostAddressesStatesEnum.START_STATE,
+                HostAddressesStatesEnum.HOST_ADDRESSES_ADDRESS_STATE,
+                UniversalTag.SEQUENCE.getValue(),
+                new CheckNotNullLength<HostAddressesContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from HostAddresses SEQ to HostAddress
         // --------------------------------------------------------------------------------------------
         // HostAddresses   ::= SEQUENCE OF
         //         HostAddress
-        super.transitions[HostAddressesStatesEnum.HOST_ADDRESSES_ADDRESS_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            HostAddressesStatesEnum.HOST_ADDRESSES_ADDRESS_STATE, HostAddressesStatesEnum.HOST_ADDRESSES_ADDRESS_STATE, UniversalTag.SEQUENCE.getValue(),
-            new AddHostAddress() );
+        super.transitions[HostAddressesStatesEnum.HOST_ADDRESSES_ADDRESS_STATE.ordinal()][UniversalTag.SEQUENCE
+            .getValue()] =
+            new GrammarTransition<HostAddressesContainer>(
+                HostAddressesStatesEnum.HOST_ADDRESSES_ADDRESS_STATE,
+                HostAddressesStatesEnum.HOST_ADDRESSES_ADDRESS_STATE,
+                UniversalTag.SEQUENCE.getValue(),
+                new AddHostAddress() );
     }
 
 
@@ -86,10 +94,10 @@ public final class HostAddressesGrammar 
 
     /**
      * Get the instance of this grammar
-     * 
+     *
      * @return An instance on the HostAddresses Grammar
      */
-    public static Grammar getInstance()
+    public static Grammar<HostAddressesContainer> getInstance()
     {
         return instance;
     }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/hostAddresses/HostAddressesStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/hostAddresses/HostAddressesStatesEnum.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/hostAddresses/HostAddressesStatesEnum.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/hostAddresses/HostAddressesStatesEnum.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.hostAddresses;
 
@@ -27,26 +27,26 @@ import org.apache.directory.shared.asn1.
 /**
  * This class store the HostAddresess grammar's constants. It is also used for debugging
  * purpose
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public enum HostAddressesStatesEnum implements States
 {
     // Start
     START_STATE,                            // 0
-    
+
     // ----- HostAddresses message --------------------------------------
     HOST_ADDRESSES_SEQ_STATE,               // 1
-    
+
     HOST_ADDRESSES_ADDRESS_STATE,           // 2
-    
+
     // End
     LAST_HOST_ADDRESSES_STATE;              // 3
 
-    
+
     /**
      * Get the grammar name
-     * 
+     *
      * @param grammar The grammar code
      * @return The grammar name
      */
@@ -58,11 +58,11 @@ public enum HostAddressesStatesEnum impl
 
     /**
      * Get the grammar name
-     * 
+     *
      * @param grammar The grammar class
      * @return The grammar name
      */
-    public String getGrammarName( Grammar grammar )
+    public String getGrammarName( Grammar<HostAddressesContainer> grammar )
     {
         if ( grammar instanceof HostAddressesGrammar )
         {
@@ -77,7 +77,7 @@ public enum HostAddressesStatesEnum impl
 
     /**
      * Get the string representing the state
-     * 
+     *
      * @param state The state number
      * @return The String representing the state
      */
@@ -86,7 +86,7 @@ public enum HostAddressesStatesEnum impl
         return ( ( state == LAST_HOST_ADDRESSES_STATE.ordinal() ) ? "HOST_ADDRESSES_END_STATE" : name() );
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
@@ -94,8 +94,8 @@ public enum HostAddressesStatesEnum impl
     {
         return this == LAST_HOST_ADDRESSES_STATE;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/hostAddresses/actions/AddHostAddress.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/hostAddresses/actions/AddHostAddress.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/hostAddresses/actions/AddHostAddress.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/hostAddresses/actions/AddHostAddress.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.hostAddresses.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;
@@ -35,10 +34,10 @@ import org.slf4j.LoggerFactory;
 
 /**
  * The action used to add an HostAddresses object
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AddHostAddress extends GrammarAction
+public class AddHostAddress extends GrammarAction<HostAddressesContainer>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( AddHostAddress.class );
@@ -59,10 +58,8 @@ public class AddHostAddress extends Gram
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    public void action( HostAddressesContainer hostAddressesContainer ) throws DecoderException
     {
-        HostAddressesContainer hostAddressesContainer = ( HostAddressesContainer ) container;
-
         TLV tlv = hostAddressesContainer.getCurrentTLV();
 
         // The Length should not be null
@@ -73,43 +70,43 @@ public class AddHostAddress extends Gram
             // This will generate a PROTOCOL_ERROR
             throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
         }
-        
+
         // Now, let's decode the HostAddress
         Asn1Decoder hostAddressDecoder = new Asn1Decoder();
-        
+
         HostAddressContainer hostAddressContainer = new HostAddressContainer();
-        hostAddressContainer.setStream( container.getStream() );
-        
-        // Compute the start position in the stream for the HostAdress to decode : 
+        hostAddressContainer.setStream( hostAddressesContainer.getStream() );
+
+        // Compute the start position in the stream for the HostAdress to decode :
         // We have to move back to the HostAddress tag
-        container.rewind();
+        hostAddressesContainer.rewind();
 
         // Decode the HostAddress PDU
         try
         {
-            hostAddressDecoder.decode( container.getStream(), hostAddressContainer );
+            hostAddressDecoder.decode( hostAddressesContainer.getStream(), hostAddressContainer );
         }
         catch ( DecoderException de )
         {
             throw de;
         }
-        
+
         // Update the expected length for the current TLV
         tlv.setExpectedLength( tlv.getExpectedLength() - tlv.getLength() );
 
         // Update the parent
-        container.updateParent();
+        hostAddressesContainer.updateParent();
 
         // Store the hostAddress in the container
         HostAddress hostAddress = hostAddressContainer.getHostAddress();
         hostAddressesContainer.addHostAddress( hostAddress );
-        
+
 
         if ( IS_DEBUG )
         {
             LOG.debug( "HostAddress added : {}", hostAddress );
         }
-        
-        container.setGrammarEndAllowed( true );
+
+        hostAddressesContainer.setGrammarEndAllowed( true );
     }
 }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcRep/KdcRepGrammar.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcRep/KdcRepGrammar.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcRep/KdcRepGrammar.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcRep/KdcRepGrammar.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.kdcRep;
 
@@ -41,10 +41,10 @@ import org.slf4j.LoggerFactory;
  * This class implements the KdcReq 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 KdcRepGrammar extends AbstractGrammar
+public final class KdcRepGrammar extends AbstractGrammar<KdcRepContainer>
 {
     /** The logger */
     static final Logger LOG = LoggerFactory.getLogger( KdcRepGrammar.class );
@@ -53,12 +53,13 @@ public final class KdcRepGrammar extends
     static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     /** The instance of grammar. KdcReqGrammar is a singleton */
-    private static Grammar instance = new KdcRepGrammar();
+    private static Grammar<KdcRepContainer> instance = new KdcRepGrammar();
 
 
     /**
      * Creates a new KdcRepGrammar object.
      */
+    @SuppressWarnings("unchecked")
     private KdcRepGrammar()
     {
         setName( KdcRepGrammar.class.getName() );
@@ -67,151 +68,194 @@ public final class KdcRepGrammar extends
         super.transitions = new GrammarTransition[KdcRepStatesEnum.LAST_KDC_REP_STATE.ordinal()][256];
 
         // ============================================================================================
-        // KdcReq 
+        // KdcReq
         // ============================================================================================
         // --------------------------------------------------------------------------------------------
         // Transition from KdcRep init to KdcRep SEQ
         // --------------------------------------------------------------------------------------------
         // KDC-REP         ::= SEQUENCE {
-        super.transitions[KdcRepStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            KdcRepStatesEnum.START_STATE, KdcRepStatesEnum.KDC_REP_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
-            new CheckNotNullLength() );
-        
+        super.transitions[KdcRepStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+            new GrammarTransition<KdcRepContainer>(
+                KdcRepStatesEnum.START_STATE,
+                KdcRepStatesEnum.KDC_REP_SEQ_STATE,
+                UniversalTag.SEQUENCE.getValue(),
+                new CheckNotNullLength<KdcRepContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from KdcRep SEQ to pvno tag
         // --------------------------------------------------------------------------------------------
         // KDC-REP         ::= SEQUENCE {
         //         pvno            [0]
-        super.transitions[KdcRepStatesEnum.KDC_REP_SEQ_STATE.ordinal()][KerberosConstants.KDC_REP_PVNO_TAG] = new GrammarTransition(
-            KdcRepStatesEnum.KDC_REP_SEQ_STATE, KdcRepStatesEnum.KDC_REP_PVNO_TAG_STATE, KerberosConstants.KDC_REP_PVNO_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[KdcRepStatesEnum.KDC_REP_SEQ_STATE.ordinal()][KerberosConstants.KDC_REP_PVNO_TAG] =
+            new GrammarTransition<KdcRepContainer>(
+                KdcRepStatesEnum.KDC_REP_SEQ_STATE,
+                KdcRepStatesEnum.KDC_REP_PVNO_TAG_STATE,
+                KerberosConstants.KDC_REP_PVNO_TAG,
+                new CheckNotNullLength<KdcRepContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from pvno tag to pvno value
         // --------------------------------------------------------------------------------------------
         // KDC-REP         ::= SEQUENCE {
         //         pvno            [0] INTEGER (5)
-        super.transitions[KdcRepStatesEnum.KDC_REP_PVNO_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = new GrammarTransition(
-            KdcRepStatesEnum.KDC_REP_PVNO_TAG_STATE, KdcRepStatesEnum.KDC_REP_PVNO_STATE, UniversalTag.INTEGER.getValue(),
-            new StorePvno() );
-        
+        super.transitions[KdcRepStatesEnum.KDC_REP_PVNO_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] =
+            new GrammarTransition<KdcRepContainer>(
+                KdcRepStatesEnum.KDC_REP_PVNO_TAG_STATE,
+                KdcRepStatesEnum.KDC_REP_PVNO_STATE,
+                UniversalTag.INTEGER.getValue(),
+                new StorePvno() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from pvno value to msg-type tag
         // --------------------------------------------------------------------------------------------
         // KDC-REP         ::= SEQUENCE {
         //         ...
         //         msg-type        [1]
-        super.transitions[KdcRepStatesEnum.KDC_REP_PVNO_STATE.ordinal()][KerberosConstants.KDC_REP_MSG_TYPE_TAG] = new GrammarTransition(
-            KdcRepStatesEnum.KDC_REP_PVNO_STATE, KdcRepStatesEnum.KDC_REP_MSG_TYPE_TAG_STATE, KerberosConstants.KDC_REP_MSG_TYPE_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[KdcRepStatesEnum.KDC_REP_PVNO_STATE.ordinal()][KerberosConstants.KDC_REP_MSG_TYPE_TAG] =
+            new GrammarTransition<KdcRepContainer>(
+                KdcRepStatesEnum.KDC_REP_PVNO_STATE,
+                KdcRepStatesEnum.KDC_REP_MSG_TYPE_TAG_STATE,
+                KerberosConstants.KDC_REP_MSG_TYPE_TAG,
+                new CheckNotNullLength<KdcRepContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from msg-type tag to msg-type value
         // --------------------------------------------------------------------------------------------
         // KDC-REP         ::= SEQUENCE {
         //         ...
         //         msg-type        [1] INTEGER (11 -- AS -- | 13 -- TGS --),
-        super.transitions[KdcRepStatesEnum.KDC_REP_MSG_TYPE_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = new GrammarTransition(
-            KdcRepStatesEnum.KDC_REP_MSG_TYPE_TAG_STATE, KdcRepStatesEnum.KDC_REP_MSG_TYPE_STATE, UniversalTag.INTEGER.getValue(),
-            new CheckMsgType() );
-        
+        super.transitions[KdcRepStatesEnum.KDC_REP_MSG_TYPE_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] =
+            new GrammarTransition<KdcRepContainer>(
+                KdcRepStatesEnum.KDC_REP_MSG_TYPE_TAG_STATE,
+                KdcRepStatesEnum.KDC_REP_MSG_TYPE_STATE,
+                UniversalTag.INTEGER.getValue(),
+                new CheckMsgType() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from msg-type value pa-data tag
         // --------------------------------------------------------------------------------------------
         // KDC-REP         ::= SEQUENCE {
         //         ...
         //         padata          [2]
-        super.transitions[KdcRepStatesEnum.KDC_REP_MSG_TYPE_STATE.ordinal()][KerberosConstants.KDC_REP_PA_DATA_TAG] = new GrammarTransition(
-            KdcRepStatesEnum.KDC_REP_MSG_TYPE_STATE, KdcRepStatesEnum.KDC_REP_PA_DATA_TAG_STATE, KerberosConstants.KDC_REP_PA_DATA_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[KdcRepStatesEnum.KDC_REP_MSG_TYPE_STATE.ordinal()][KerberosConstants.KDC_REP_PA_DATA_TAG] =
+            new GrammarTransition<KdcRepContainer>(
+                KdcRepStatesEnum.KDC_REP_MSG_TYPE_STATE,
+                KdcRepStatesEnum.KDC_REP_PA_DATA_TAG_STATE,
+                KerberosConstants.KDC_REP_PA_DATA_TAG,
+                new CheckNotNullLength<KdcRepContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from pa-data tag to pa-data sequence
         // --------------------------------------------------------------------------------------------
         // KDC-REP         ::= SEQUENCE {
         //         ...
-        //         padata          [2] SEQUENCE OF 
-        super.transitions[KdcRepStatesEnum.KDC_REP_PA_DATA_TAG_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            KdcRepStatesEnum.KDC_REP_PA_DATA_TAG_STATE, KdcRepStatesEnum.KDC_REP_PA_DATA_STATE, UniversalTag.SEQUENCE.getValue(),
-            new CheckNotNullLength() );
-        
+        //         padata          [2] SEQUENCE OF
+        super.transitions[KdcRepStatesEnum.KDC_REP_PA_DATA_TAG_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+            new GrammarTransition<KdcRepContainer>(
+                KdcRepStatesEnum.KDC_REP_PA_DATA_TAG_STATE,
+                KdcRepStatesEnum.KDC_REP_PA_DATA_STATE,
+                UniversalTag.SEQUENCE.getValue(),
+                new CheckNotNullLength<KdcRepContainer>() );
+
         // --------------------------------------------------------------------------------------------
-        // Transition from pa-data sequence to PA-DATA 
+        // Transition from pa-data sequence to PA-DATA
         // --------------------------------------------------------------------------------------------
         // KDC-REP         ::= SEQUENCE {
         //         ...
         //         padata          [2] SEQUENCE OF PA-DATA
-        super.transitions[KdcRepStatesEnum.KDC_REP_PA_DATA_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            KdcRepStatesEnum.KDC_REP_PA_DATA_STATE, KdcRepStatesEnum.KDC_REP_PA_DATA_STATE, UniversalTag.SEQUENCE.getValue(),
-            new AddPaData() );
-        
+        super.transitions[KdcRepStatesEnum.KDC_REP_PA_DATA_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+            new GrammarTransition<KdcRepContainer>(
+                KdcRepStatesEnum.KDC_REP_PA_DATA_STATE,
+                KdcRepStatesEnum.KDC_REP_PA_DATA_STATE,
+                UniversalTag.SEQUENCE.getValue(),
+                new AddPaData() );
+
         // --------------------------------------------------------------------------------------------
-        // Transition from PA-DATA to crealm tag 
+        // Transition from PA-DATA to crealm tag
         // --------------------------------------------------------------------------------------------
         // KDC-REP         ::= SEQUENCE {
         //         ...
         //         crealm          [3]
-        super.transitions[KdcRepStatesEnum.KDC_REP_PA_DATA_STATE.ordinal()][KerberosConstants.KDC_REP_CREALM_TAG] = new GrammarTransition(
-            KdcRepStatesEnum.KDC_REP_PA_DATA_STATE, KdcRepStatesEnum.KDC_REP_CREALM_TAG_STATE, KerberosConstants.KDC_REP_CREALM_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[KdcRepStatesEnum.KDC_REP_PA_DATA_STATE.ordinal()][KerberosConstants.KDC_REP_CREALM_TAG] =
+            new GrammarTransition<KdcRepContainer>(
+                KdcRepStatesEnum.KDC_REP_PA_DATA_STATE,
+                KdcRepStatesEnum.KDC_REP_CREALM_TAG_STATE,
+                KerberosConstants.KDC_REP_CREALM_TAG,
+                new CheckNotNullLength<KdcRepContainer>() );
+
         // --------------------------------------------------------------------------------------------
-        // Transition from msg-type value to crealm tag (pa-data is empty) 
+        // Transition from msg-type value to crealm tag (pa-data is empty)
         // --------------------------------------------------------------------------------------------
         // KDC-REP         ::= SEQUENCE {
         //         ...
         //         crealm          [3]
-        super.transitions[KdcRepStatesEnum.KDC_REP_MSG_TYPE_STATE.ordinal()][KerberosConstants.KDC_REP_CREALM_TAG] = new GrammarTransition(
-            KdcRepStatesEnum.KDC_REP_MSG_TYPE_STATE, KdcRepStatesEnum.KDC_REP_CREALM_TAG_STATE, KerberosConstants.KDC_REP_CREALM_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[KdcRepStatesEnum.KDC_REP_MSG_TYPE_STATE.ordinal()][KerberosConstants.KDC_REP_CREALM_TAG] =
+            new GrammarTransition<KdcRepContainer>(
+                KdcRepStatesEnum.KDC_REP_MSG_TYPE_STATE,
+                KdcRepStatesEnum.KDC_REP_CREALM_TAG_STATE,
+                KerberosConstants.KDC_REP_CREALM_TAG,
+                new CheckNotNullLength<KdcRepContainer>() );
+
         // --------------------------------------------------------------------------------------------
-        // Transition from crealm tag to crealm value 
+        // Transition from crealm tag to crealm value
         // --------------------------------------------------------------------------------------------
         // KDC-REP         ::= SEQUENCE {
         //         ...
         //         crealm          [3] Realm,
-        super.transitions[KdcRepStatesEnum.KDC_REP_CREALM_TAG_STATE.ordinal()][UniversalTag.GENERAL_STRING.getValue()] = new GrammarTransition(
-            KdcRepStatesEnum.KDC_REP_CREALM_TAG_STATE, KdcRepStatesEnum.KDC_REP_CREALM_STATE, UniversalTag.GENERAL_STRING.getValue(),
-            new StoreCRealm() );
-        
+        super.transitions[KdcRepStatesEnum.KDC_REP_CREALM_TAG_STATE.ordinal()][UniversalTag.GENERAL_STRING.getValue()] =
+            new GrammarTransition<KdcRepContainer>(
+                KdcRepStatesEnum.KDC_REP_CREALM_TAG_STATE,
+                KdcRepStatesEnum.KDC_REP_CREALM_STATE,
+                UniversalTag.GENERAL_STRING.getValue(),
+                new StoreCRealm() );
+
         // --------------------------------------------------------------------------------------------
-        // Transition from crealm value to cname 
+        // Transition from crealm value to cname
         // --------------------------------------------------------------------------------------------
         // KDC-REP         ::= SEQUENCE {
         //         ...
         //         cname           [4] PrincipalName,
-        super.transitions[KdcRepStatesEnum.KDC_REP_CREALM_STATE.ordinal()][KerberosConstants.KDC_REP_CNAME_TAG] = new GrammarTransition(
-            KdcRepStatesEnum.KDC_REP_CREALM_STATE, KdcRepStatesEnum.KDC_REP_CNAME_STATE, KerberosConstants.KDC_REP_CNAME_TAG,
-            new StoreCName() );
-        
+        super.transitions[KdcRepStatesEnum.KDC_REP_CREALM_STATE.ordinal()][KerberosConstants.KDC_REP_CNAME_TAG] =
+            new GrammarTransition<KdcRepContainer>(
+                KdcRepStatesEnum.KDC_REP_CREALM_STATE,
+                KdcRepStatesEnum.KDC_REP_CNAME_STATE,
+                KerberosConstants.KDC_REP_CNAME_TAG,
+                new StoreCName() );
+
         // --------------------------------------------------------------------------------------------
-        // Transition from cname to ticket 
+        // Transition from cname to ticket
         // --------------------------------------------------------------------------------------------
         // KDC-REP         ::= SEQUENCE {
         //         ...
         //         ticket          [5] Ticket,
-        super.transitions[KdcRepStatesEnum.KDC_REP_CNAME_STATE.ordinal()][KerberosConstants.KDC_REP_TICKET_TAG] = new GrammarTransition(
-            KdcRepStatesEnum.KDC_REP_CNAME_STATE, KdcRepStatesEnum.KDC_REP_TICKET_STATE, KerberosConstants.KDC_REP_TICKET_TAG,
-            new StoreTicket() );
-        
+        super.transitions[KdcRepStatesEnum.KDC_REP_CNAME_STATE.ordinal()][KerberosConstants.KDC_REP_TICKET_TAG] =
+            new GrammarTransition<KdcRepContainer>(
+                KdcRepStatesEnum.KDC_REP_CNAME_STATE,
+                KdcRepStatesEnum.KDC_REP_TICKET_STATE,
+                KerberosConstants.KDC_REP_TICKET_TAG,
+                new StoreTicket() );
+
         // --------------------------------------------------------------------------------------------
-        // Transition from ticket to enc-part 
+        // Transition from ticket to enc-part
         // --------------------------------------------------------------------------------------------
         // KDC-REP         ::= SEQUENCE {
         //         ...
         //         enc-part        [6] EncryptedData
-        super.transitions[KdcRepStatesEnum.KDC_REP_TICKET_STATE.ordinal()][KerberosConstants.KDC_REP_ENC_PART_TAG] = new GrammarTransition(
-            KdcRepStatesEnum.KDC_REP_TICKET_STATE, KdcRepStatesEnum.KDC_REP_ENC_PART_STATE, KerberosConstants.KDC_REP_ENC_PART_TAG,
-            new StoreEncPart() );
+        super.transitions[KdcRepStatesEnum.KDC_REP_TICKET_STATE.ordinal()][KerberosConstants.KDC_REP_ENC_PART_TAG] =
+            new GrammarTransition<KdcRepContainer>(
+                KdcRepStatesEnum.KDC_REP_TICKET_STATE,
+                KdcRepStatesEnum.KDC_REP_ENC_PART_STATE,
+                KerberosConstants.KDC_REP_ENC_PART_TAG,
+                new StoreEncPart() );
     }
 
+
     /**
      * Get the instance of this grammar
-     * 
+     *
      * @return An instance on the KDC-REQ Grammar
      */
-    public static Grammar getInstance()
+    public static Grammar<KdcRepContainer> getInstance()
     {
         return instance;
     }



Mime
View raw message