directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1068124 [6/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/di...
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/authorizationData/actions/AuthorizationDataInit.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/authorizationData/actions/AuthorizationDataInit.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/authorizationData/actions/AuthorizationDataInit.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/authorizationData/actions/AuthorizationDataInit.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.authorizationData.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.authorizationData.AuthorizationDataContainer;
 import org.apache.directory.shared.kerberos.components.AuthorizationData;
 import org.slf4j.Logger;
@@ -33,10 +32,10 @@ import org.slf4j.LoggerFactory;
 
 /**
  * The action used to initialize the AuthorizationData object
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AuthorizationDataInit extends GrammarAction
+public class AuthorizationDataInit extends GrammarAction<AuthorizationDataContainer>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( AuthorizationDataInit.class );
@@ -57,11 +56,9 @@ public class AuthorizationDataInit exten
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    public void action( AuthorizationDataContainer authorizationDataContainer ) throws DecoderException
     {
-        AuthorizationDataContainer authDataContainer = ( AuthorizationDataContainer ) container;
-
-        TLV tlv = authDataContainer.getCurrentTLV();
+        TLV tlv = authorizationDataContainer.getCurrentTLV();
 
         // The Length should not be null
         if ( tlv.getLength() == 0 )
@@ -71,13 +68,13 @@ public class AuthorizationDataInit exten
             // This will generate a PROTOCOL_ERROR
             throw new DecoderException( I18n.err( I18n.ERR_744_NULL_PDU_LENGTH ) );
         }
-        
-        if ( authDataContainer.getAuthorizationData() == null )
+
+        if ( authorizationDataContainer.getAuthorizationData() == null )
         {
             AuthorizationData authData = new AuthorizationData();
-            authDataContainer.setAuthorizationData( authData );
-            
-            
+            authorizationDataContainer.setAuthorizationData( authData );
+
+
             if ( IS_DEBUG )
             {
                 LOG.debug( "AuthorizationData created" );

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

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/authorizationData/actions/StoreAdType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/authorizationData/actions/StoreAdType.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/authorizationData/actions/StoreAdType.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/authorizationData/actions/StoreAdType.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.authorizationData.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.asn1.actions.AbstractReadInteger;
 import org.apache.directory.shared.kerberos.codec.authorizationData.AuthorizationDataContainer;
 import org.apache.directory.shared.kerberos.codec.encryptedData.actions.StoreEType;
@@ -32,10 +31,10 @@ import org.slf4j.LoggerFactory;
 
 /**
  * The action used to store the AuthorizationData adType
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreAdType extends AbstractReadInteger
+public class StoreAdType extends AbstractReadInteger<AuthorizationDataContainer>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( StoreEType.class );
@@ -56,16 +55,14 @@ public class StoreAdType extends Abstrac
      * {@inheritDoc}
      */
     @Override
-    protected void setIntegerValue( int value, Asn1Container container )
+    protected void setIntegerValue( int value, AuthorizationDataContainer authorizationDataContainer )
     {
-        AuthorizationDataContainer authDataContainer = ( AuthorizationDataContainer ) container;
-        
         AuthorizationType authType = AuthorizationType.getTypeByValue( value );
-        
-        AuthorizationData authorizationData = authDataContainer.getAuthorizationData();
+
+        AuthorizationData authorizationData = authorizationDataContainer.getAuthorizationData();
         authorizationData.createNewAD();
         authorizationData.setCurrentAdType( authType );
-        
+
         if ( IS_DEBUG )
         {
             LOG.debug( "zdType : {}", authType );

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/checksum/ChecksumGrammar.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/checksum/ChecksumGrammar.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/checksum/ChecksumGrammar.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/checksum/ChecksumGrammar.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.checksum;
 
@@ -37,10 +37,10 @@ import org.slf4j.LoggerFactory;
  * This class implements the Checksum 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 ChecksumGrammar extends AbstractGrammar
+public final class ChecksumGrammar extends AbstractGrammar<ChecksumContainer>
 {
     /** The logger */
     static final Logger LOG = LoggerFactory.getLogger( ChecksumGrammar.class );
@@ -49,12 +49,13 @@ public final class ChecksumGrammar exten
     static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     /** The instance of grammar. ChecksumGrammar is a singleton */
-    private static Grammar instance = new ChecksumGrammar();
+    private static Grammar<ChecksumContainer> instance = new ChecksumGrammar();
 
 
     /**
      * Creates a new ChecksumGrammar object.
      */
+    @SuppressWarnings("unchecked")
     private ChecksumGrammar()
     {
         setName( ChecksumGrammar.class.getName() );
@@ -63,63 +64,75 @@ public final class ChecksumGrammar exten
         super.transitions = new GrammarTransition[ChecksumStatesEnum.LAST_CHECKSUM_STATE.ordinal()][256];
 
         // ============================================================================================
-        // Checksum 
+        // Checksum
         // ============================================================================================
         // --------------------------------------------------------------------------------------------
         // Transition from Checksum init to Checksum SEQ OF
         // --------------------------------------------------------------------------------------------
         // Checksum   ::= SEQUENCE OF
-        super.transitions[ChecksumStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            ChecksumStatesEnum.START_STATE, ChecksumStatesEnum.CHECKSUM_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
-            new ChecksumInit() );
-        
+        super.transitions[ChecksumStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+            new GrammarTransition<ChecksumContainer>(
+                ChecksumStatesEnum.START_STATE,
+                ChecksumStatesEnum.CHECKSUM_SEQ_STATE,
+                UniversalTag.SEQUENCE.getValue(),
+                new ChecksumInit() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from Checksum SEQ to checksumtype
         // --------------------------------------------------------------------------------------------
         // Checksum      ::= SEQUENCE {
         //        cksumtype       [0]
-        super.transitions[ChecksumStatesEnum.CHECKSUM_SEQ_STATE.ordinal()][KerberosConstants.CHECKSUM_TYPE_TAG] = new GrammarTransition(
-            ChecksumStatesEnum.CHECKSUM_SEQ_STATE, ChecksumStatesEnum.CHECKSUM_TYPE_TAG_STATE, KerberosConstants.CHECKSUM_TYPE_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[ChecksumStatesEnum.CHECKSUM_SEQ_STATE.ordinal()][KerberosConstants.CHECKSUM_TYPE_TAG] =
+            new GrammarTransition<ChecksumContainer>(
+                ChecksumStatesEnum.CHECKSUM_SEQ_STATE,
+                ChecksumStatesEnum.CHECKSUM_TYPE_TAG_STATE,
+                KerberosConstants.CHECKSUM_TYPE_TAG,
+                new CheckNotNullLength<ChecksumContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from checksumtype tag to checksumtype
         // --------------------------------------------------------------------------------------------
         // Checksum      ::= SEQUENCE {
         //          cksumtype       [0] Int32
-        super.transitions[ChecksumStatesEnum.CHECKSUM_TYPE_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = new GrammarTransition(
-            ChecksumStatesEnum.CHECKSUM_TYPE_TAG_STATE, ChecksumStatesEnum.CHECKSUM_TYPE_STATE, UniversalTag.INTEGER.getValue(),
-            new StoreCksumType() );
-        
+        super.transitions[ChecksumStatesEnum.CHECKSUM_TYPE_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] =
+            new GrammarTransition<ChecksumContainer>(
+                ChecksumStatesEnum.CHECKSUM_TYPE_TAG_STATE,
+                ChecksumStatesEnum.CHECKSUM_TYPE_STATE,
+                UniversalTag.INTEGER.getValue(),
+                new StoreCksumType() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from checksumtype to checksum tag
         // --------------------------------------------------------------------------------------------
         // Checksum      ::= SEQUENCE {
         //          checksum        [1]
-        super.transitions[ChecksumStatesEnum.CHECKSUM_TYPE_STATE.ordinal()][KerberosConstants.CHECKSUM_CHECKSUM_TAG] = new GrammarTransition(
-            ChecksumStatesEnum.CHECKSUM_TYPE_STATE, ChecksumStatesEnum.CHECKSUM_CHECKSUM_TAG_STATE, KerberosConstants.CHECKSUM_CHECKSUM_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[ChecksumStatesEnum.CHECKSUM_TYPE_STATE.ordinal()][KerberosConstants.CHECKSUM_CHECKSUM_TAG] =
+            new GrammarTransition<ChecksumContainer>(
+                ChecksumStatesEnum.CHECKSUM_TYPE_STATE,
+                ChecksumStatesEnum.CHECKSUM_CHECKSUM_TAG_STATE,
+                KerberosConstants.CHECKSUM_CHECKSUM_TAG,
+                new CheckNotNullLength<ChecksumContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from checksum tag to checksum value
         // --------------------------------------------------------------------------------------------
         // Checksum      ::= SEQUENCE {
         //          checksum        [1] OCTET STRING
-        super.transitions[ChecksumStatesEnum.CHECKSUM_CHECKSUM_TAG_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
-            ChecksumStatesEnum.CHECKSUM_CHECKSUM_TAG_STATE, ChecksumStatesEnum.CHECKSUM_CHECKSUM_STATE, UniversalTag.OCTET_STRING.getValue(),
-            new StoreChecksum() );
+        super.transitions[ChecksumStatesEnum.CHECKSUM_CHECKSUM_TAG_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] =
+            new GrammarTransition<ChecksumContainer>(
+                ChecksumStatesEnum.CHECKSUM_CHECKSUM_TAG_STATE,
+                ChecksumStatesEnum.CHECKSUM_CHECKSUM_STATE,
+                UniversalTag.OCTET_STRING.getValue(),
+                new StoreChecksum() );
     }
 
 
-    // ~ Methods
-    // ------------------------------------------------------------------------------------
-
     /**
      * Get the instance of this grammar
-     * 
+     *
      * @return An instance on the Checksum Grammar
      */
-    public static Grammar getInstance()
+    public static Grammar<ChecksumContainer> getInstance()
     {
         return instance;
     }

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

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

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

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/checksum/actions/StoreCksumType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/checksum/actions/StoreCksumType.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/checksum/actions/StoreCksumType.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/checksum/actions/StoreCksumType.java Mon Feb  7 20:49:04 2011
@@ -21,13 +21,12 @@
 package org.apache.directory.shared.kerberos.codec.checksum.actions;
 
 
-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.DecoderException;
+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.i18n.I18n;
 import org.apache.directory.shared.kerberos.codec.checksum.ChecksumContainer;
 import org.apache.directory.shared.kerberos.components.Checksum;
@@ -42,7 +41,7 @@ import org.slf4j.LoggerFactory;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreCksumType extends GrammarAction
+public class StoreCksumType extends GrammarAction<ChecksumContainer>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( StoreCksumType.class );
@@ -57,15 +56,13 @@ public class StoreCksumType extends Gram
     {
         super( "Checksum cksumtype" );
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    public void action( ChecksumContainer checksumContainer ) throws DecoderException
     {
-        ChecksumContainer checksumContainer = ( ChecksumContainer ) container;
-
         TLV tlv = checksumContainer.getCurrentTLV();
 
         // The Length should not be null
@@ -76,11 +73,11 @@ public class StoreCksumType extends Gram
             // This will generate a PROTOCOL_ERROR
             throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
         }
-        
+
         Checksum checksum = checksumContainer.getChecksum();
         // The Checksum's type is an integer
         Value value = tlv.getValue();
-        
+
         try
         {
             int cksumType = IntegerDecoder.parse( value );

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encApRepPart/EncApRepPartGrammar.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encApRepPart/EncApRepPartGrammar.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encApRepPart/EncApRepPartGrammar.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encApRepPart/EncApRepPartGrammar.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.encApRepPart;
 
@@ -39,10 +39,10 @@ import org.slf4j.LoggerFactory;
  * This class implements the EncApRepPart 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 EncApRepPartGrammar extends AbstractGrammar
+public final class EncApRepPartGrammar extends AbstractGrammar<EncApRepPartContainer>
 {
     /** The logger */
     static final Logger LOG = LoggerFactory.getLogger( EncApRepPartGrammar.class );
@@ -51,12 +51,13 @@ public final class EncApRepPartGrammar e
     static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     /** The instance of grammar. EncApRepPartGrammar is a singleton */
-    private static Grammar instance = new EncApRepPartGrammar();
+    private static Grammar<EncApRepPartContainer> instance = new EncApRepPartGrammar();
 
 
     /**
      * Creates a new EncApRepPartGrammar object.
      */
+    @SuppressWarnings("unchecked")
     private EncApRepPartGrammar()
     {
         setName( EncApRepPartGrammar.class.getName() );
@@ -65,91 +66,118 @@ public final class EncApRepPartGrammar e
         super.transitions = new GrammarTransition[EncApRepPartStatesEnum.LAST_ENC_AP_REP_PART_STATE.ordinal()][256];
 
         // ============================================================================================
-        // EncApRepPart 
+        // EncApRepPart
         // ============================================================================================
         // --------------------------------------------------------------------------------------------
         // Transition from EncApRepPart init to APPLICATION tag
         // --------------------------------------------------------------------------------------------
         // EncAPRepPart    ::= [APPLICATION 27]
-        super.transitions[EncApRepPartStatesEnum.START_STATE.ordinal()][KerberosConstants.ENC_AP_REP_PART_TAG] = new GrammarTransition(
-            EncApRepPartStatesEnum.START_STATE, EncApRepPartStatesEnum.ENC_AP_REP_PART_STATE, KerberosConstants.ENC_AP_REP_PART_TAG,
-            new EncApRepPartInit() );
-        
+        super.transitions[EncApRepPartStatesEnum.START_STATE.ordinal()][KerberosConstants.ENC_AP_REP_PART_TAG] =
+            new GrammarTransition<EncApRepPartContainer>(
+                EncApRepPartStatesEnum.START_STATE,
+                EncApRepPartStatesEnum.ENC_AP_REP_PART_STATE,
+                KerberosConstants.ENC_AP_REP_PART_TAG,
+                new EncApRepPartInit() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from EncApRepPart APPLICATION to EncApRepPart SEQ
         // --------------------------------------------------------------------------------------------
         // EncAPRepPart    ::= [APPLICATION 27] SEQUENCE {
-        super.transitions[EncApRepPartStatesEnum.ENC_AP_REP_PART_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            EncApRepPartStatesEnum.ENC_AP_REP_PART_STATE, EncApRepPartStatesEnum.ENC_AP_REP_PART_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
-            new CheckNotNullLength() );
-        
+        super.transitions[EncApRepPartStatesEnum.ENC_AP_REP_PART_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+            new GrammarTransition<EncApRepPartContainer>(
+                EncApRepPartStatesEnum.ENC_AP_REP_PART_STATE,
+                EncApRepPartStatesEnum.ENC_AP_REP_PART_SEQ_STATE,
+                UniversalTag.SEQUENCE.getValue(),
+                new CheckNotNullLength<EncApRepPartContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from EncApRepPart SEQ to ctime tag
         // --------------------------------------------------------------------------------------------
         // EncAPRepPart    ::= [APPLICATION 27] SEQUENCE {
         //         ctime           [0]
-        super.transitions[EncApRepPartStatesEnum.ENC_AP_REP_PART_SEQ_STATE.ordinal()][KerberosConstants.ENC_AP_REP_PART_CTIME_TAG] = new GrammarTransition(
-            EncApRepPartStatesEnum.ENC_AP_REP_PART_SEQ_STATE, EncApRepPartStatesEnum.ENC_AP_REP_PART_CTIME_TAG_STATE, KerberosConstants.ENC_AP_REP_PART_CTIME_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[EncApRepPartStatesEnum.ENC_AP_REP_PART_SEQ_STATE.ordinal()][KerberosConstants.ENC_AP_REP_PART_CTIME_TAG] =
+            new GrammarTransition<EncApRepPartContainer>(
+                EncApRepPartStatesEnum.ENC_AP_REP_PART_SEQ_STATE,
+                EncApRepPartStatesEnum.ENC_AP_REP_PART_CTIME_TAG_STATE,
+                KerberosConstants.ENC_AP_REP_PART_CTIME_TAG,
+                new CheckNotNullLength<EncApRepPartContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from ctime tag to ctime value
         // --------------------------------------------------------------------------------------------
         // EncAPRepPart    ::= [APPLICATION 27] SEQUENCE {
         //         ctime           [0] KerberosTime,
-        super.transitions[EncApRepPartStatesEnum.ENC_AP_REP_PART_CTIME_TAG_STATE.ordinal()][UniversalTag.GENERALIZED_TIME.getValue()] = new GrammarTransition(
-            EncApRepPartStatesEnum.ENC_AP_REP_PART_CTIME_TAG_STATE, EncApRepPartStatesEnum.ENC_AP_REP_PART_CTIME_STATE, UniversalTag.GENERALIZED_TIME.getValue(),
-            new StoreCTime() );
-        
+        super.transitions[EncApRepPartStatesEnum.ENC_AP_REP_PART_CTIME_TAG_STATE.ordinal()][UniversalTag.GENERALIZED_TIME.getValue()] =
+            new GrammarTransition<EncApRepPartContainer>(
+                EncApRepPartStatesEnum.ENC_AP_REP_PART_CTIME_TAG_STATE,
+                EncApRepPartStatesEnum.ENC_AP_REP_PART_CTIME_STATE,
+                UniversalTag.GENERALIZED_TIME.getValue(),
+                new StoreCTime() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from ctime value to cusec tag
         // --------------------------------------------------------------------------------------------
         // EncAPRepPart    ::= [APPLICATION 27] SEQUENCE {
         //         ...
         //         cusec           [1]
-        super.transitions[EncApRepPartStatesEnum.ENC_AP_REP_PART_CTIME_STATE.ordinal()][KerberosConstants.ENC_AP_REP_PART_CUSEC_TAG] = new GrammarTransition(
-            EncApRepPartStatesEnum.ENC_AP_REP_PART_CTIME_STATE, EncApRepPartStatesEnum.ENC_AP_REP_PART_CUSEC_TAG_STATE, KerberosConstants.ENC_AP_REP_PART_CUSEC_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[EncApRepPartStatesEnum.ENC_AP_REP_PART_CTIME_STATE.ordinal()][KerberosConstants.ENC_AP_REP_PART_CUSEC_TAG] =
+            new GrammarTransition<EncApRepPartContainer>(
+                EncApRepPartStatesEnum.ENC_AP_REP_PART_CTIME_STATE,
+                EncApRepPartStatesEnum.ENC_AP_REP_PART_CUSEC_TAG_STATE,
+                KerberosConstants.ENC_AP_REP_PART_CUSEC_TAG,
+                new CheckNotNullLength<EncApRepPartContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from cusec tag to cusec value
         // --------------------------------------------------------------------------------------------
         // EncAPRepPart    ::= [APPLICATION 27] SEQUENCE {
         //         ...
         //         cusec           [1] Microseconds,
-        super.transitions[EncApRepPartStatesEnum.ENC_AP_REP_PART_CUSEC_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = new GrammarTransition(
-            EncApRepPartStatesEnum.ENC_AP_REP_PART_CUSEC_TAG_STATE, EncApRepPartStatesEnum.ENC_AP_REP_PART_CUSEC_STATE, UniversalTag.INTEGER.getValue(),
-            new StoreCusec() );
-        
+        super.transitions[EncApRepPartStatesEnum.ENC_AP_REP_PART_CUSEC_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] =
+            new GrammarTransition<EncApRepPartContainer>(
+                EncApRepPartStatesEnum.ENC_AP_REP_PART_CUSEC_TAG_STATE,
+                EncApRepPartStatesEnum.ENC_AP_REP_PART_CUSEC_STATE,
+                UniversalTag.INTEGER.getValue(),
+                new StoreCusec() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from cusec value to subkey
         // --------------------------------------------------------------------------------------------
         // EncAPRepPart    ::= [APPLICATION 27] SEQUENCE {
         //         ...
         //         subkey          [2] <EncryptionKey> OPTIONAL,
-        super.transitions[EncApRepPartStatesEnum.ENC_AP_REP_PART_CUSEC_STATE.ordinal()][KerberosConstants.ENC_AP_REP_PART_SUB_KEY_TAG] = new GrammarTransition(
-            EncApRepPartStatesEnum.ENC_AP_REP_PART_CUSEC_STATE, EncApRepPartStatesEnum.ENC_AP_REP_PART_SUBKEY_STATE, KerberosConstants.ENC_AP_REP_PART_SUB_KEY_TAG,
-            new StoreSubKey() );
-        
+        super.transitions[EncApRepPartStatesEnum.ENC_AP_REP_PART_CUSEC_STATE.ordinal()][KerberosConstants.ENC_AP_REP_PART_SUB_KEY_TAG] =
+            new GrammarTransition<EncApRepPartContainer>(
+                EncApRepPartStatesEnum.ENC_AP_REP_PART_CUSEC_STATE,
+                EncApRepPartStatesEnum.ENC_AP_REP_PART_SUBKEY_STATE,
+                KerberosConstants.ENC_AP_REP_PART_SUB_KEY_TAG,
+                new StoreSubKey() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from cusec value to seq-number tag
         // --------------------------------------------------------------------------------------------
         // EncAPRepPart    ::= [APPLICATION 27] SEQUENCE {
         //         ...
         //         seq-number      [3] UInt32 OPTIONAL
-        super.transitions[EncApRepPartStatesEnum.ENC_AP_REP_PART_CUSEC_STATE.ordinal()][KerberosConstants.ENC_AP_REP_PART_SEQ_NUMBER_TAG] = new GrammarTransition(
-            EncApRepPartStatesEnum.ENC_AP_REP_PART_CUSEC_STATE, EncApRepPartStatesEnum.ENC_AP_REP_PART_SEQ_NUMBER_TAG_STATE, KerberosConstants.ENC_AP_REP_PART_SEQ_NUMBER_TAG,
-            new CheckNotNullLength() );
-        
+        super.transitions[EncApRepPartStatesEnum.ENC_AP_REP_PART_CUSEC_STATE.ordinal()][KerberosConstants.ENC_AP_REP_PART_SEQ_NUMBER_TAG] =
+            new GrammarTransition<EncApRepPartContainer>(
+                EncApRepPartStatesEnum.ENC_AP_REP_PART_CUSEC_STATE,
+                EncApRepPartStatesEnum.ENC_AP_REP_PART_SEQ_NUMBER_TAG_STATE,
+                KerberosConstants.ENC_AP_REP_PART_SEQ_NUMBER_TAG,
+                new CheckNotNullLength<EncApRepPartContainer>() );
+
         // --------------------------------------------------------------------------------------------
         // Transition from subkey to seq-number tag
         // --------------------------------------------------------------------------------------------
         // EncAPRepPart    ::= [APPLICATION 27] SEQUENCE {
         //         ...
         //         seq-number      [3] UInt32 OPTIONAL
-        super.transitions[EncApRepPartStatesEnum.ENC_AP_REP_PART_SUBKEY_STATE.ordinal()][KerberosConstants.ENC_AP_REP_PART_SEQ_NUMBER_TAG] = new GrammarTransition(
-            EncApRepPartStatesEnum.ENC_AP_REP_PART_SUBKEY_STATE, EncApRepPartStatesEnum.ENC_AP_REP_PART_SEQ_NUMBER_TAG_STATE, KerberosConstants.ENC_AP_REP_PART_SEQ_NUMBER_TAG,
-            new CheckNotNullLength() );
+        super.transitions[EncApRepPartStatesEnum.ENC_AP_REP_PART_SUBKEY_STATE.ordinal()][KerberosConstants.ENC_AP_REP_PART_SEQ_NUMBER_TAG] =
+            new GrammarTransition<EncApRepPartContainer>(
+                EncApRepPartStatesEnum.ENC_AP_REP_PART_SUBKEY_STATE,
+                EncApRepPartStatesEnum.ENC_AP_REP_PART_SEQ_NUMBER_TAG_STATE,
+                KerberosConstants.ENC_AP_REP_PART_SEQ_NUMBER_TAG,
+                new CheckNotNullLength<EncApRepPartContainer>() );
 
         // --------------------------------------------------------------------------------------------
         // Transition from seq-number tag to seq-number value
@@ -158,18 +186,21 @@ public final class EncApRepPartGrammar e
         //         ...
         //         seq-number      [3] UInt32 OPTIONAL
         // }
-        super.transitions[EncApRepPartStatesEnum.ENC_AP_REP_PART_SEQ_NUMBER_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = new GrammarTransition(
-            EncApRepPartStatesEnum.ENC_AP_REP_PART_SEQ_NUMBER_TAG_STATE, EncApRepPartStatesEnum.ENC_AP_REP_PART_SEQ_NUMBER_STATE, UniversalTag.INTEGER.getValue(),
-            new StoreSeqNumber() );
+        super.transitions[EncApRepPartStatesEnum.ENC_AP_REP_PART_SEQ_NUMBER_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] =
+            new GrammarTransition<EncApRepPartContainer>(
+                EncApRepPartStatesEnum.ENC_AP_REP_PART_SEQ_NUMBER_TAG_STATE,
+                EncApRepPartStatesEnum.ENC_AP_REP_PART_SEQ_NUMBER_STATE,
+                UniversalTag.INTEGER.getValue(),
+                new StoreSeqNumber() );
     }
 
 
     /**
      * Get the instance of this grammar
-     * 
+     *
      * @return An instance on the EncApRepPart Grammar
      */
-    public static Grammar getInstance()
+    public static Grammar<EncApRepPartContainer> getInstance()
     {
         return instance;
     }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encApRepPart/EncApRepPartStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encApRepPart/EncApRepPartStatesEnum.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encApRepPart/EncApRepPartStatesEnum.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encApRepPart/EncApRepPartStatesEnum.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.encApRepPart;
 
@@ -27,24 +27,24 @@ import org.apache.directory.shared.asn1.
 /**
  * This class store the EncApRepPart grammar's constants. It is also used for debugging
  * purpose
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public enum EncApRepPartStatesEnum implements States
 {
     // Start
     START_STATE,                            // 0
-    
+
     // ----- EncApRepPart message --------------------------------------
     ENC_AP_REP_PART_STATE,                  // 1
     ENC_AP_REP_PART_SEQ_STATE,              // 2
-    
+
     ENC_AP_REP_PART_CTIME_TAG_STATE,        // 3
     ENC_AP_REP_PART_CTIME_STATE,            // 4
-    
+
     ENC_AP_REP_PART_CUSEC_TAG_STATE,        // 5
     ENC_AP_REP_PART_CUSEC_STATE,            // 6
-    
+
     ENC_AP_REP_PART_SUBKEY_STATE,           // 7
 
     ENC_AP_REP_PART_SEQ_NUMBER_TAG_STATE,   // 8
@@ -53,10 +53,10 @@ public enum EncApRepPartStatesEnum imple
     // End
     LAST_ENC_AP_REP_PART_STATE;             // 10
 
-    
+
     /**
      * Get the grammar name
-     * 
+     *
      * @param grammar The grammar code
      * @return The grammar name
      */
@@ -68,11 +68,11 @@ public enum EncApRepPartStatesEnum imple
 
     /**
      * Get the grammar name
-     * 
+     *
      * @param grammar The grammar class
      * @return The grammar name
      */
-    public String getGrammarName( Grammar grammar )
+    public String getGrammarName( Grammar<EncApRepPartContainer> grammar )
     {
         if ( grammar instanceof EncApRepPartGrammar )
         {
@@ -87,7 +87,7 @@ public enum EncApRepPartStatesEnum imple
 
     /**
      * Get the string representing the state
-     * 
+     *
      * @param state The state number
      * @return The String representing the state
      */
@@ -96,7 +96,7 @@ public enum EncApRepPartStatesEnum imple
         return ( ( state == LAST_ENC_AP_REP_PART_STATE.ordinal() ) ? "ENC_AP_REP_PART_END_STATE" : name() );
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
@@ -104,8 +104,8 @@ public enum EncApRepPartStatesEnum imple
     {
         return this == LAST_ENC_AP_REP_PART_STATE;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encApRepPart/actions/EncApRepPartInit.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encApRepPart/actions/EncApRepPartInit.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encApRepPart/actions/EncApRepPartInit.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encApRepPart/actions/EncApRepPartInit.java Mon Feb  7 20:49:04 2011
@@ -6,24 +6,23 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.kerberos.codec.encApRepPart.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
+import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
-import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.kerberos.codec.encApRepPart.EncApRepPartContainer;
 import org.apache.directory.shared.kerberos.messages.EncApRepPart;
@@ -33,10 +32,10 @@ import org.slf4j.LoggerFactory;
 
 /**
  * The action used to initialize the EncApRepPart object
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class EncApRepPartInit extends GrammarAction
+public class EncApRepPartInit extends GrammarAction<EncApRepPartContainer>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( EncApRepPartInit.class );
@@ -57,10 +56,8 @@ public class EncApRepPartInit extends Gr
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    public void action( EncApRepPartContainer encApRepPartContainer ) throws DecoderException
     {
-        EncApRepPartContainer encApRepPartContainer = ( EncApRepPartContainer ) container;
-
         TLV tlv = encApRepPartContainer.getCurrentTLV();
 
         // The Length should not be null
@@ -71,10 +68,10 @@ public class EncApRepPartInit extends Gr
             // This will generate a PROTOCOL_ERROR
             throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
         }
-        
+
         EncApRepPart encApRepPart = new EncApRepPart();
         encApRepPartContainer.setEncApRepPart( encApRepPart );
-        
+
         if ( IS_DEBUG )
         {
             LOG.debug( "EncApRepPart created" );

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

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

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encApRepPart/actions/StoreSeqNumber.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encApRepPart/actions/StoreSeqNumber.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encApRepPart/actions/StoreSeqNumber.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encApRepPart/actions/StoreSeqNumber.java Mon Feb  7 20:49:04 2011
@@ -6,31 +6,30 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.kerberos.codec.encApRepPart.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.asn1.actions.AbstractReadInteger;
 import org.apache.directory.shared.kerberos.codec.encApRepPart.EncApRepPartContainer;
 
 
 /**
  * The action used to store the seq-number
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreSeqNumber extends AbstractReadInteger
+public class StoreSeqNumber extends AbstractReadInteger<EncApRepPartContainer>
 {
 
     /**
@@ -46,9 +45,8 @@ public class StoreSeqNumber extends Abst
      * {@inheritDoc}
      */
     @Override
-    protected void setIntegerValue( int value, Asn1Container container )
+    protected void setIntegerValue( int value, EncApRepPartContainer encApRepPartContainer )
     {
-        EncApRepPartContainer encApRepPartContainer = ( EncApRepPartContainer ) container;
         encApRepPartContainer.getEncApRepPart().setSeqNumber( value );
         encApRepPartContainer.setGrammarEndAllowed( true );
     }

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encApRepPart/actions/StoreSubKey.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encApRepPart/actions/StoreSubKey.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encApRepPart/actions/StoreSubKey.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encApRepPart/actions/StoreSubKey.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.encApRepPart.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.kerberos.codec.actions.AbstractReadEncryptionKey;
 import org.apache.directory.shared.kerberos.codec.encApRepPart.EncApRepPartContainer;
 import org.apache.directory.shared.kerberos.components.EncryptionKey;
@@ -28,10 +27,10 @@ import org.apache.directory.shared.kerbe
 
 /**
  * The action used to set the EncApRepPart subkey
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreSubKey extends AbstractReadEncryptionKey
+public class StoreSubKey extends AbstractReadEncryptionKey<EncApRepPartContainer>
 {
     /**
      * Instantiates a new StoreEncryptionKey action.
@@ -46,9 +45,8 @@ public class StoreSubKey extends Abstrac
      * {@inheritDoc}
      */
     @Override
-    protected void setEncryptionKey( EncryptionKey encryptionKey, Asn1Container container )
+    protected void setEncryptionKey( EncryptionKey encryptionKey, EncApRepPartContainer encApRepPartContainer )
     {
-        EncApRepPartContainer encApRepPartContainer = ( EncApRepPartContainer ) container;
         encApRepPartContainer.getEncApRepPart().setSubkey( encryptionKey );
         encApRepPartContainer.setGrammarEndAllowed( true );
     }

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

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

Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encAsRepPart/actions/StoreEncAsRepPart.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encAsRepPart/actions/StoreEncAsRepPart.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encAsRepPart/actions/StoreEncAsRepPart.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encAsRepPart/actions/StoreEncAsRepPart.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.encAsRepPart.actions;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
+import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
-import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.kerberos.codec.EncKdcRepPart.EncKdcRepPartContainer;
 import org.apache.directory.shared.kerberos.codec.encAsRepPart.EncAsRepPartContainer;
@@ -35,10 +34,10 @@ import org.slf4j.LoggerFactory;
 
 /**
  * The action used to add a EncAsRepPart object
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreEncAsRepPart extends GrammarAction
+public class StoreEncAsRepPart extends GrammarAction<EncAsRepPartContainer>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( StoreEncAsRepPart.class );
@@ -59,10 +58,8 @@ public class StoreEncAsRepPart extends G
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    public void action( EncAsRepPartContainer encAsRepPartContainer ) throws DecoderException
     {
-        EncAsRepPartContainer encAsRepPartContainer = ( EncAsRepPartContainer ) container;
-
         TLV tlv = encAsRepPartContainer.getCurrentTLV();
 
         // The Length should not be null
@@ -73,28 +70,28 @@ public class StoreEncAsRepPart extends G
             // This will generate a PROTOCOL_ERROR
             throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
         }
-        
+
         // Now, let's decode the EncKdcRepPart
         Asn1Decoder encKdcRepPartDecoder = new Asn1Decoder();
-        
-        EncKdcRepPartContainer encKdcRepPartContainer = new EncKdcRepPartContainer( container.getStream() );
-        
+
+        EncKdcRepPartContainer encKdcRepPartContainer = new EncKdcRepPartContainer( encAsRepPartContainer.getStream() );
+
         // Decode the EncKdcRepPart PDU
         try
         {
-            encKdcRepPartDecoder.decode( container.getStream(), encKdcRepPartContainer );
+            encKdcRepPartDecoder.decode( encAsRepPartContainer.getStream(), encKdcRepPartContainer );
         }
         catch ( DecoderException de )
         {
             throw de;
         }
-        
+
         // Update the expected length for the current TLV
         tlv.setExpectedLength( tlv.getExpectedLength() - tlv.getLength() );
 
         // Update the parent
-        container.updateParent();
-        
+        encAsRepPartContainer.updateParent();
+
         EncKdcRepPart encKdcRepPart = encKdcRepPartContainer.getEncKdcRepPart();
 
         encAsRepPartContainer.getEncAsRepPart().setEncKdcRepPart( encKdcRepPart );
@@ -103,7 +100,7 @@ public class StoreEncAsRepPart extends G
         {
             LOG.debug( "EncAsRepPart : {}", encKdcRepPart );
         }
-        
-        container.setGrammarEndAllowed( true );
+
+        encAsRepPartContainer.setGrammarEndAllowed( true );
     }
 }



Mime
View raw message