Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptedData/EncryptedDataStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptedData/EncryptedDataStatesEnum.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptedData/EncryptedDataStatesEnum.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptedData/EncryptedDataStatesEnum.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.encryptedData;
@@ -27,33 +27,33 @@ import org.apache.directory.shared.asn1.
/**
* This class store the EncryptedData grammar's constants. It is also used for debugging
* purpose
- *
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
public enum EncryptedDataStatesEnum implements States
{
// Start
START_STATE, // 0
-
+
// ----- EncryptedData message --------------------------------------
ENCRYPTED_DATA_SEQ_STATE, // 1
-
+
ENCRYPTED_DATA_ETYPE_TAG_STATE, // 2
ENCRYPTED_DATA_ETYPE_STATE, // 3
-
+
ENCRYPTED_DATA_KVNO_TAG_STATE, // 4
ENCRYPTED_DATA_KVNO_STATE, // 5
-
+
ENCRYPTED_DATA_CIPHER_TAG_STATE, // 6
ENCRYPTED_DATA_CIPHER_STATE, // 7
-
+
// End
LAST_ENCRYPTED_DATA_STATE; // 8
-
+
/**
* Get the grammar name
- *
+ *
* @param grammar The grammar code
* @return The grammar name
*/
@@ -65,11 +65,11 @@ public enum EncryptedDataStatesEnum impl
/**
* Get the grammar name
- *
+ *
* @param grammar The grammar class
* @return The grammar name
*/
- public String getGrammarName( Grammar grammar )
+ public String getGrammarName( Grammar<EncryptedDataContainer> grammar )
{
if ( grammar instanceof EncryptedDataGrammar )
{
@@ -84,7 +84,7 @@ public enum EncryptedDataStatesEnum impl
/**
* Get the string representing the state
- *
+ *
* @param state The state number
* @return The String representing the state
*/
@@ -93,7 +93,7 @@ public enum EncryptedDataStatesEnum impl
return ( ( state == LAST_ENCRYPTED_DATA_STATE.ordinal() ) ? "ENCRYPTED_DATA_END_STATE" : name() );
}
-
+
/**
* {@inheritDoc}
*/
@@ -101,8 +101,8 @@ public enum EncryptedDataStatesEnum impl
{
return this == LAST_ENCRYPTED_DATA_STATE;
}
-
-
+
+
/**
* {@inheritDoc}
*/
Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptedData/actions/EncryptedDataInit.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptedData/actions/EncryptedDataInit.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptedData/actions/EncryptedDataInit.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptedData/actions/EncryptedDataInit.java Mon Feb 7 20:49:04 2011
@@ -6,23 +6,22 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
- *
+ * under the License.
+ *
*/
package org.apache.directory.shared.kerberos.codec.encryptedData.actions;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.shared.asn1.DecoderException;
-import org.apache.directory.shared.asn1.ber.Asn1Container;
import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
import org.apache.directory.shared.asn1.ber.tlv.TLV;
import org.apache.directory.shared.kerberos.codec.encryptedData.EncryptedDataContainer;
@@ -33,10 +32,10 @@ import org.slf4j.LoggerFactory;
/**
* The action used to initialize the EncryptedData object
- *
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class EncryptedDataInit extends GrammarAction
+public class EncryptedDataInit extends GrammarAction<EncryptedDataContainer>
{
/** The logger */
private static final Logger LOG = LoggerFactory.getLogger( EncryptedDataInit.class );
@@ -57,10 +56,8 @@ public class EncryptedDataInit extends G
/**
* {@inheritDoc}
*/
- public void action( Asn1Container container ) throws DecoderException
+ public void action( EncryptedDataContainer encryptedDataContainer ) throws DecoderException
{
- EncryptedDataContainer encryptedDataContainer = ( EncryptedDataContainer ) container;
-
TLV tlv = encryptedDataContainer.getCurrentTLV();
// The Length should not be null
@@ -71,12 +68,12 @@ public class EncryptedDataInit extends G
// This will generate a PROTOCOL_ERROR
throw new DecoderException( I18n.err( I18n.ERR_744_NULL_PDU_LENGTH ) );
}
-
+
if ( encryptedDataContainer.getEncryptedData() == null )
{
EncryptedData encryptedData = new EncryptedData();
encryptedDataContainer.setEncryptedData( encryptedData );
-
+
if ( IS_DEBUG )
{
LOG.debug( "EncryptedData created" );
Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptedData/actions/StoreCipher.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptedData/actions/StoreCipher.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptedData/actions/StoreCipher.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptedData/actions/StoreCipher.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.encryptedData.actions;
-import org.apache.directory.shared.asn1.ber.Asn1Container;
import org.apache.directory.shared.asn1.actions.AbstractReadOctetString;
import org.apache.directory.shared.kerberos.codec.encryptedData.EncryptedDataContainer;
/**
* The action used to store the EncryptedPart cipher
- *
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class StoreCipher extends AbstractReadOctetString
+public class StoreCipher extends AbstractReadOctetString<EncryptedDataContainer>
{
/**
* Instantiates a new EncryptedPart Cipher action.
@@ -45,10 +44,9 @@ public class StoreCipher extends Abstrac
* {@inheritDoc}
*/
@Override
- protected void setOctetString( byte[] data, Asn1Container container )
+ protected void setOctetString( byte[] data, EncryptedDataContainer encryptedDataContainer )
{
- EncryptedDataContainer encryptedDataContainer = ( EncryptedDataContainer ) container;
encryptedDataContainer.getEncryptedData().setCipher( data );
- container.setGrammarEndAllowed( true );
+ encryptedDataContainer.setGrammarEndAllowed( true );
}
}
Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptedData/actions/StoreEType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptedData/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/encryptedData/actions/StoreEType.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptedData/actions/StoreEType.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.encryptedData.actions;
-import org.apache.directory.shared.asn1.ber.Asn1Container;
import org.apache.directory.shared.asn1.actions.AbstractReadInteger;
import org.apache.directory.shared.kerberos.codec.encryptedData.EncryptedDataContainer;
import org.apache.directory.shared.kerberos.codec.types.EncryptionType;
@@ -31,10 +30,10 @@ import org.slf4j.LoggerFactory;
/**
* The action used to store the EncryptedPart EType
- *
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class StoreEType extends AbstractReadInteger
+public class StoreEType extends AbstractReadInteger<EncryptedDataContainer>
{
/** The logger */
private static final Logger LOG = LoggerFactory.getLogger( StoreEType.class );
@@ -55,15 +54,13 @@ public class StoreEType extends Abstract
* {@inheritDoc}
*/
@Override
- protected void setIntegerValue( int value, Asn1Container container )
+ protected void setIntegerValue( int value, EncryptedDataContainer encryptedDataContainer )
{
- EncryptedDataContainer encryptedDataContainer = ( EncryptedDataContainer ) container;
-
EncryptionType encryptionType = EncryptionType.getTypeByValue( value );
-
+
EncryptedData encryptedData = encryptedDataContainer.getEncryptedData();
encryptedData.setEType( encryptionType );
-
+
if ( IS_DEBUG )
{
LOG.debug( "e-type : {}", encryptionType );
Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptedData/actions/StoreKvno.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptedData/actions/StoreKvno.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptedData/actions/StoreKvno.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptedData/actions/StoreKvno.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.encryptedData.actions;
-import org.apache.directory.shared.asn1.ber.Asn1Container;
import org.apache.directory.shared.asn1.actions.AbstractReadInteger;
import org.apache.directory.shared.kerberos.codec.encryptedData.EncryptedDataContainer;
import org.apache.directory.shared.kerberos.components.EncryptedData;
@@ -28,10 +27,10 @@ import org.apache.directory.shared.kerbe
/**
* The action used to store the EncryptedPart Kvno
- *
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class StoreKvno extends AbstractReadInteger
+public class StoreKvno extends AbstractReadInteger<EncryptedDataContainer>
{
/**
* Instantiates a new EncryptedPartKvno action.
@@ -46,10 +45,8 @@ public class StoreKvno extends AbstractR
* {@inheritDoc}
*/
@Override
- protected void setIntegerValue( int value, Asn1Container container )
+ protected void setIntegerValue( int value, EncryptedDataContainer encryptedDataContainer )
{
- EncryptedDataContainer encryptedDataContainer = ( EncryptedDataContainer ) container;
-
EncryptedData encryptedData = encryptedDataContainer.getEncryptedData();
encryptedData.setKvno( value );
}
Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptionKey/EncryptionKeyGrammar.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptionKey/EncryptionKeyGrammar.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptionKey/EncryptionKeyGrammar.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptionKey/EncryptionKeyGrammar.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.encryptionKey;
+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.encryptionKey.actions.EncryptionKeyInit;
import org.apache.directory.shared.kerberos.codec.encryptionKey.actions.StoreKeyType;
@@ -37,10 +37,10 @@ import org.slf4j.LoggerFactory;
* This class implements the EncryptionKey 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 EncryptionKeyGrammar extends AbstractGrammar
+public final class EncryptionKeyGrammar extends AbstractGrammar<EncryptionKeyContainer>
{
/** The logger */
static final Logger LOG = LoggerFactory.getLogger( EncryptionKeyGrammar.class );
@@ -49,12 +49,13 @@ public final class EncryptionKeyGrammar
static final boolean IS_DEBUG = LOG.isDebugEnabled();
/** The instance of grammar. EncryptionKeyGrammar is a singleton */
- private static Grammar instance = new EncryptionKeyGrammar();
+ private static Grammar<EncryptionKeyContainer> instance = new EncryptionKeyGrammar();
/**
* Creates a new EncryptionKeyGrammar object.
*/
+ @SuppressWarnings("unchecked")
private EncryptionKeyGrammar()
{
setName( EncryptionKeyGrammar.class.getName() );
@@ -63,61 +64,77 @@ public final class EncryptionKeyGrammar
super.transitions = new GrammarTransition[EncryptionKeyStatesEnum.LAST_ENCRYPTION_KEY_STATE.ordinal()][256];
// ============================================================================================
- // EncryptionKey
+ // EncryptionKey
// ============================================================================================
// --------------------------------------------------------------------------------------------
// Transition from EncryptionKey init to EncryptionKey SEQ OF
// --------------------------------------------------------------------------------------------
// EncryptionKey ::= SEQUENCE {
- super.transitions[EncryptionKeyStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
- EncryptionKeyStatesEnum.START_STATE, EncryptionKeyStatesEnum.ENCRYPTION_KEY_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
- new EncryptionKeyInit() );
-
+ super.transitions[EncryptionKeyStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+ new GrammarTransition<EncryptionKeyContainer>(
+ EncryptionKeyStatesEnum.START_STATE,
+ EncryptionKeyStatesEnum.ENCRYPTION_KEY_SEQ_STATE,
+ UniversalTag.SEQUENCE.getValue(),
+ new EncryptionKeyInit() );
+
// --------------------------------------------------------------------------------------------
// Transition from EncryptionKey SEQ to key-type tag
// --------------------------------------------------------------------------------------------
// EncryptionKey ::= SEQUENCE {
// keytype [0]
- super.transitions[EncryptionKeyStatesEnum.ENCRYPTION_KEY_SEQ_STATE.ordinal()][KerberosConstants.ENCRYPTION_KEY_TYPE_TAG] = new GrammarTransition(
- EncryptionKeyStatesEnum.ENCRYPTION_KEY_SEQ_STATE, EncryptionKeyStatesEnum.ENCRYPTION_KEY_TYPE_TAG_STATE, KerberosConstants.ENCRYPTION_KEY_TYPE_TAG,
- new CheckNotNullLength() );
-
+ super.transitions[EncryptionKeyStatesEnum.ENCRYPTION_KEY_SEQ_STATE.ordinal()][KerberosConstants.ENCRYPTION_KEY_TYPE_TAG] =
+ new GrammarTransition<EncryptionKeyContainer>(
+ EncryptionKeyStatesEnum.ENCRYPTION_KEY_SEQ_STATE,
+ EncryptionKeyStatesEnum.ENCRYPTION_KEY_TYPE_TAG_STATE,
+ KerberosConstants.ENCRYPTION_KEY_TYPE_TAG,
+ new CheckNotNullLength<EncryptionKeyContainer>() );
+
// --------------------------------------------------------------------------------------------
// Transition from EncryptionKey type tag to key-type value
// --------------------------------------------------------------------------------------------
// EncryptionKey ::= SEQUENCE {
// keytype [0] Int32
- super.transitions[EncryptionKeyStatesEnum.ENCRYPTION_KEY_TYPE_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = new GrammarTransition(
- EncryptionKeyStatesEnum.ENCRYPTION_KEY_TYPE_TAG_STATE, EncryptionKeyStatesEnum.ENCRYPTION_KEY_TYPE_STATE, UniversalTag.INTEGER.getValue(),
- new StoreKeyType() );
-
+ super.transitions[EncryptionKeyStatesEnum.ENCRYPTION_KEY_TYPE_TAG_STATE.ordinal()][UniversalTag.INTEGER
+ .getValue()] =
+ new GrammarTransition<EncryptionKeyContainer>(
+ EncryptionKeyStatesEnum.ENCRYPTION_KEY_TYPE_TAG_STATE,
+ EncryptionKeyStatesEnum.ENCRYPTION_KEY_TYPE_STATE,
+ UniversalTag.INTEGER.getValue(),
+ new StoreKeyType() );
+
// --------------------------------------------------------------------------------------------
// Transition from key-type to key-value tag
// --------------------------------------------------------------------------------------------
// EncryptionKey ::= SEQUENCE {
// ...
// keyvalue [2]
- super.transitions[EncryptionKeyStatesEnum.ENCRYPTION_KEY_TYPE_STATE.ordinal()][KerberosConstants.ENCRYPTION_KEY_VALUE_TAG] = new GrammarTransition(
- EncryptionKeyStatesEnum.ENCRYPTION_KEY_TYPE_STATE, EncryptionKeyStatesEnum.ENCRYPTION_KEY_VALUE_TAG_STATE, KerberosConstants.ENCRYPTION_KEY_VALUE_TAG,
- new CheckNotNullLength() );
-
+ super.transitions[EncryptionKeyStatesEnum.ENCRYPTION_KEY_TYPE_STATE.ordinal()][KerberosConstants.ENCRYPTION_KEY_VALUE_TAG] =
+ new GrammarTransition<EncryptionKeyContainer>(
+ EncryptionKeyStatesEnum.ENCRYPTION_KEY_TYPE_STATE,
+ EncryptionKeyStatesEnum.ENCRYPTION_KEY_VALUE_TAG_STATE,
+ KerberosConstants.ENCRYPTION_KEY_VALUE_TAG,
+ new CheckNotNullLength<EncryptionKeyContainer>() );
+
// --------------------------------------------------------------------------------------------
// Transition from key-value tag to key-value value
// --------------------------------------------------------------------------------------------
// EncryptionKey ::= SEQUENCE {
// keyvalue [2] OCTET STRING
- super.transitions[EncryptionKeyStatesEnum.ENCRYPTION_KEY_VALUE_TAG_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
- EncryptionKeyStatesEnum.ENCRYPTION_KEY_VALUE_TAG_STATE, EncryptionKeyStatesEnum.ENCRYPTION_KEY_VALUE_STATE, UniversalTag.OCTET_STRING.getValue(),
- new StoreKeyValue() );
+ super.transitions[EncryptionKeyStatesEnum.ENCRYPTION_KEY_VALUE_TAG_STATE.ordinal()][UniversalTag.OCTET_STRING
+ .getValue()] =
+ new GrammarTransition<EncryptionKeyContainer>(
+ EncryptionKeyStatesEnum.ENCRYPTION_KEY_VALUE_TAG_STATE,
+ EncryptionKeyStatesEnum.ENCRYPTION_KEY_VALUE_STATE, UniversalTag.OCTET_STRING.getValue(),
+ new StoreKeyValue() );
}
/**
* Get the instance of this grammar
- *
+ *
* @return An instance on the EncryptionKey Grammar
*/
- public static Grammar getInstance()
+ public static Grammar<EncryptionKeyContainer> getInstance()
{
return instance;
}
Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptionKey/EncryptionKeyStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptionKey/EncryptionKeyStatesEnum.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptionKey/EncryptionKeyStatesEnum.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptionKey/EncryptionKeyStatesEnum.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.encryptionKey;
@@ -27,31 +27,31 @@ import org.apache.directory.shared.asn1.
/**
* This class store the EncryptionKey grammar's constants. It is also used for debugging
* purpose
- *
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
public enum EncryptionKeyStatesEnum implements States
{
// Start
START_STATE, // 0
-
+
ENCRYPTION_KEY_SEQ_STATE, // 1
-
+
ENCRYPTION_KEY_TYPE_TAG_STATE, // 2
-
+
ENCRYPTION_KEY_TYPE_STATE, // 3
-
+
ENCRYPTION_KEY_VALUE_TAG_STATE, // 4
-
+
ENCRYPTION_KEY_VALUE_STATE, // 5
-
+
// End
LAST_ENCRYPTION_KEY_STATE; // 6
-
+
/**
* Get the grammar name
- *
+ *
* @param grammar The grammar code
* @return The grammar name
*/
@@ -63,11 +63,11 @@ public enum EncryptionKeyStatesEnum impl
/**
* Get the grammar name
- *
+ *
* @param grammar The grammar class
* @return The grammar name
*/
- public String getGrammarName( Grammar grammar )
+ public String getGrammarName( Grammar<EncryptionKeyContainer> grammar )
{
if ( grammar instanceof EncryptionKeyGrammar )
{
@@ -82,7 +82,7 @@ public enum EncryptionKeyStatesEnum impl
/**
* Get the string representing the state
- *
+ *
* @param state The state number
* @return The String representing the state
*/
@@ -91,7 +91,7 @@ public enum EncryptionKeyStatesEnum impl
return ( ( state == LAST_ENCRYPTION_KEY_STATE.ordinal() ) ? "LAST_ENCRYPTION_KEY_STATE" : name() );
}
-
+
/**
* {@inheritDoc}
*/
@@ -99,8 +99,8 @@ public enum EncryptionKeyStatesEnum impl
{
return this == LAST_ENCRYPTION_KEY_STATE;
}
-
-
+
+
/**
* {@inheritDoc}
*/
Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptionKey/actions/EncryptionKeyInit.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptionKey/actions/EncryptionKeyInit.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptionKey/actions/EncryptionKeyInit.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptionKey/actions/EncryptionKeyInit.java Mon Feb 7 20:49:04 2011
@@ -6,23 +6,22 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
- *
+ * under the License.
+ *
*/
package org.apache.directory.shared.kerberos.codec.encryptionKey.actions;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.shared.asn1.DecoderException;
-import org.apache.directory.shared.asn1.ber.Asn1Container;
import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
import org.apache.directory.shared.asn1.ber.tlv.TLV;
import org.apache.directory.shared.kerberos.codec.encryptionKey.EncryptionKeyContainer;
@@ -33,10 +32,10 @@ import org.slf4j.LoggerFactory;
/**
* The action used to initialize the EncryptionKey object
- *
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class EncryptionKeyInit extends GrammarAction
+public class EncryptionKeyInit extends GrammarAction<EncryptionKeyContainer>
{
/** The logger */
private static final Logger LOG = LoggerFactory.getLogger( EncryptionKeyInit.class );
@@ -57,11 +56,9 @@ public class EncryptionKeyInit extends G
/**
* {@inheritDoc}
*/
- public void action( Asn1Container container ) throws DecoderException
+ public void action( EncryptionKeyContainer encryptionKeyContainer ) throws DecoderException
{
- EncryptionKeyContainer encKeyContainer = ( EncryptionKeyContainer ) container;
-
- TLV tlv = encKeyContainer.getCurrentTLV();
+ TLV tlv = encryptionKeyContainer.getCurrentTLV();
// The Length should not be null
if ( tlv.getLength() == 0 )
@@ -71,10 +68,10 @@ public class EncryptionKeyInit extends G
// This will generate a PROTOCOL_ERROR
throw new DecoderException( I18n.err( I18n.ERR_744_NULL_PDU_LENGTH ) );
}
-
+
EncryptionKey encKey = new EncryptionKey();
- encKeyContainer.setEncryptionKey( encKey );
-
+ encryptionKeyContainer.setEncryptionKey( encKey );
+
if ( IS_DEBUG )
{
LOG.debug( "EncryptionKey created" );
Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptionKey/actions/StoreKeyType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptionKey/actions/StoreKeyType.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptionKey/actions/StoreKeyType.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptionKey/actions/StoreKeyType.java Mon Feb 7 20:49:04 2011
@@ -21,7 +21,6 @@
package org.apache.directory.shared.kerberos.codec.encryptionKey.actions;
-import org.apache.directory.shared.asn1.ber.Asn1Container;
import org.apache.directory.shared.asn1.actions.AbstractReadInteger;
import org.apache.directory.shared.kerberos.codec.encryptionKey.EncryptionKeyContainer;
import org.apache.directory.shared.kerberos.codec.types.EncryptionType;
@@ -35,7 +34,7 @@ import org.slf4j.LoggerFactory;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class StoreKeyType extends AbstractReadInteger
+public class StoreKeyType extends AbstractReadInteger<EncryptionKeyContainer>
{
/** The logger */
private static final Logger LOG = LoggerFactory.getLogger( StoreKeyType.class );
@@ -56,13 +55,12 @@ public class StoreKeyType extends Abstra
* {@inheritDoc}
*/
@Override
- protected void setIntegerValue( int value, Asn1Container container )
+ protected void setIntegerValue( int value, EncryptionKeyContainer encryptionKeyContainer )
{
- EncryptionKeyContainer encKeyContainer = ( EncryptionKeyContainer ) container;
- EncryptionKey encKey = encKeyContainer.getEncryptionKey();
-
+ EncryptionKey encKey = encryptionKeyContainer.getEncryptionKey();
+
EncryptionType encryptionType = EncryptionType.getTypeByValue( value );
-
+
encKey.setKeyType( encryptionType );
if ( IS_DEBUG )
Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptionKey/actions/StoreKeyValue.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptionKey/actions/StoreKeyValue.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptionKey/actions/StoreKeyValue.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/encryptionKey/actions/StoreKeyValue.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.encryptionKey.actions;
-import org.apache.directory.shared.asn1.ber.Asn1Container;
import org.apache.directory.shared.asn1.actions.AbstractReadOctetString;
import org.apache.directory.shared.kerberos.codec.encryptionKey.EncryptionKeyContainer;
/**
* The action used to store the EncryptionKey's keyvalue
- *
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class StoreKeyValue extends AbstractReadOctetString
+public class StoreKeyValue extends AbstractReadOctetString<EncryptionKeyContainer>
{
/**
* Instantiates a new EncryptionKeyKeyValue action.
@@ -45,10 +44,9 @@ public class StoreKeyValue extends Abstr
* {@inheritDoc}
*/
@Override
- protected void setOctetString( byte[] data, Asn1Container container )
+ protected void setOctetString( byte[] data, EncryptionKeyContainer encryptionKeyContainer )
{
- EncryptionKeyContainer encKeyContainer = ( EncryptionKeyContainer ) container;
- encKeyContainer.getEncryptionKey().setKeyValue( data );
- container.setGrammarEndAllowed( true );
+ encryptionKeyContainer.getEncryptionKey().setKeyValue( data );
+ encryptionKeyContainer.setGrammarEndAllowed( true );
}
}
Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo/ETypeInfoGrammar.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo/ETypeInfoGrammar.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo/ETypeInfoGrammar.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo/ETypeInfoGrammar.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.etypeInfo;
@@ -34,10 +34,10 @@ import org.slf4j.LoggerFactory;
* This class implements the ETYPE-INFO 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 ETypeInfoGrammar extends AbstractGrammar
+public final class ETypeInfoGrammar extends AbstractGrammar<ETypeInfoContainer>
{
/** The logger */
static final Logger LOG = LoggerFactory.getLogger( ETypeInfoGrammar.class );
@@ -46,12 +46,13 @@ public final class ETypeInfoGrammar exte
static final boolean IS_DEBUG = LOG.isDebugEnabled();
/** The instance of grammar. ETypeInfoGrammar is a singleton */
- private static Grammar instance = new ETypeInfoGrammar();
+ private static Grammar<ETypeInfoContainer> instance = new ETypeInfoGrammar();
/**
* Creates a new ETypeInfoGrammar object.
*/
+ @SuppressWarnings("unchecked")
private ETypeInfoGrammar()
{
setName( ETypeInfoGrammar.class.getName() );
@@ -60,33 +61,39 @@ public final class ETypeInfoGrammar exte
super.transitions = new GrammarTransition[ETypeInfoStatesEnum.LAST_ETYPE_INFO_STATE.ordinal()][256];
// ============================================================================================
- // ETYPE-INFO
+ // ETYPE-INFO
// ============================================================================================
// --------------------------------------------------------------------------------------------
// Transition from ETYPE-INFO init to ETYPE-INFO SEQ
// --------------------------------------------------------------------------------------------
// ETYPE-INFO-ENTRY ::= SEQUENCE
- super.transitions[ETypeInfoStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
- ETypeInfoStatesEnum.START_STATE, ETypeInfoStatesEnum.ETYPE_INFO_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
- new CheckNotNullLength() );
-
+ super.transitions[ETypeInfoStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+ new GrammarTransition<ETypeInfoContainer>(
+ ETypeInfoStatesEnum.START_STATE,
+ ETypeInfoStatesEnum.ETYPE_INFO_SEQ_STATE,
+ UniversalTag.SEQUENCE.getValue(),
+ new CheckNotNullLength<ETypeInfoContainer>() );
+
// --------------------------------------------------------------------------------------------
// Transition from ETYPE-INFO init to ETYPE-INFO SEQ
// --------------------------------------------------------------------------------------------
// ETYPE-INFO-ENTRY ::= SEQUENCE OF <ETYPE-INFO-ENTRY>
- //
- super.transitions[ETypeInfoStatesEnum.ETYPE_INFO_SEQ_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
- ETypeInfoStatesEnum.ETYPE_INFO_SEQ_STATE, ETypeInfoStatesEnum.ETYPE_INFO_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
- new AddETypeInfoEntry() );
+ //
+ super.transitions[ETypeInfoStatesEnum.ETYPE_INFO_SEQ_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+ new GrammarTransition<ETypeInfoContainer>(
+ ETypeInfoStatesEnum.ETYPE_INFO_SEQ_STATE,
+ ETypeInfoStatesEnum.ETYPE_INFO_SEQ_STATE,
+ UniversalTag.SEQUENCE.getValue(),
+ new AddETypeInfoEntry() );
}
/**
* Get the instance of this grammar
- *
+ *
* @return An instance on the ETYPE-INFO Grammar
*/
- public static Grammar getInstance()
+ public static Grammar<ETypeInfoContainer> getInstance()
{
return instance;
}
Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo/ETypeInfoStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo/ETypeInfoStatesEnum.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo/ETypeInfoStatesEnum.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo/ETypeInfoStatesEnum.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.etypeInfo;
@@ -27,23 +27,23 @@ import org.apache.directory.shared.asn1.
/**
* This class store the ETYPE-INFO grammar's constants. It is also used for debugging
* purpose
- *
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
public enum ETypeInfoStatesEnum implements States
{
// Start
START_STATE, // 0
-
+
ETYPE_INFO_SEQ_STATE, // 1
-
+
// End
LAST_ETYPE_INFO_STATE; // 2
-
+
/**
* Get the grammar name
- *
+ *
* @param grammar The grammar code
* @return The grammar name
*/
@@ -55,11 +55,11 @@ public enum ETypeInfoStatesEnum implemen
/**
* Get the grammar name
- *
+ *
* @param grammar The grammar class
* @return The grammar name
*/
- public String getGrammarName( Grammar grammar )
+ public String getGrammarName( Grammar<ETypeInfoContainer> grammar )
{
if ( grammar instanceof ETypeInfoGrammar )
{
@@ -74,7 +74,7 @@ public enum ETypeInfoStatesEnum implemen
/**
* Get the string representing the state
- *
+ *
* @param state The state number
* @return The String representing the state
*/
@@ -83,7 +83,7 @@ public enum ETypeInfoStatesEnum implemen
return ( ( state == LAST_ETYPE_INFO_STATE.ordinal() ) ? "LAST_ETYPE_INFO_STATE" : name() );
}
-
+
/**
* {@inheritDoc}
*/
@@ -91,8 +91,8 @@ public enum ETypeInfoStatesEnum implemen
{
return this == LAST_ETYPE_INFO_STATE;
}
-
-
+
+
/**
* {@inheritDoc}
*/
Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo/actions/AddETypeInfoEntry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo/actions/AddETypeInfoEntry.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo/actions/AddETypeInfoEntry.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo/actions/AddETypeInfoEntry.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.etypeInfo.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.etypeInfo.ETypeInfoContainer;
import org.apache.directory.shared.kerberos.codec.etypeInfoEntry.ETypeInfoEntryContainer;
@@ -35,10 +34,10 @@ import org.slf4j.LoggerFactory;
/**
* The action used to add an ETypeInfoEntry object
- *
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class AddETypeInfoEntry extends GrammarAction
+public class AddETypeInfoEntry extends GrammarAction<ETypeInfoContainer>
{
/** The logger */
private static final Logger LOG = LoggerFactory.getLogger( AddETypeInfoEntry.class );
@@ -59,11 +58,9 @@ public class AddETypeInfoEntry extends G
/**
* {@inheritDoc}
*/
- public void action( Asn1Container container ) throws DecoderException
+ public void action( ETypeInfoContainer eTypeInfoContainer ) throws DecoderException
{
- ETypeInfoContainer etypeInfoContainer = ( ETypeInfoContainer ) container;
-
- TLV tlv = etypeInfoContainer.getCurrentTLV();
+ TLV tlv = eTypeInfoContainer.getCurrentTLV();
// The Length should not be null
if ( tlv.getLength() == 0 )
@@ -73,43 +70,43 @@ public class AddETypeInfoEntry extends G
// This will generate a PROTOCOL_ERROR
throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
}
-
+
// Now, let's decode the ETYPE-INFO-ENTRY
Asn1Decoder etypeInfoEntryDecoder = new Asn1Decoder();
-
+
ETypeInfoEntryContainer etypeInfoEntryContainer = new ETypeInfoEntryContainer();
- etypeInfoEntryContainer.setStream( container.getStream() );
-
- // Compute the start position in the stream for the ETypeInfoEntry to decode :
+ etypeInfoEntryContainer.setStream( eTypeInfoContainer.getStream() );
+
+ // Compute the start position in the stream for the ETypeInfoEntry to decode :
// We have to move back to the ETypeInfoEntry tag
- container.rewind();
+ eTypeInfoContainer.rewind();
// Decode the ETypeInfoEntry PDU
try
{
- etypeInfoEntryDecoder.decode( container.getStream(), etypeInfoEntryContainer );
+ etypeInfoEntryDecoder.decode( eTypeInfoContainer.getStream(), etypeInfoEntryContainer );
}
catch ( DecoderException de )
{
throw de;
}
-
+
// Update the expected length for the current TLV
tlv.setExpectedLength( tlv.getExpectedLength() - tlv.getLength() );
// Update the parent
- container.updateParent();
+ eTypeInfoContainer.updateParent();
// Store the ETypeInfoEntry in the container
ETypeInfoEntry etypeInfoEntry = etypeInfoEntryContainer.getETypeInfoEntry();
- etypeInfoContainer.addEtypeInfoEntry( etypeInfoEntry );
-
+ eTypeInfoContainer.addEtypeInfoEntry( etypeInfoEntry );
+
if ( IS_DEBUG )
{
LOG.debug( "ETYPE-INFO-ENTRY added : {}", etypeInfoEntry );
}
-
- container.setGrammarEndAllowed( true );
+
+ eTypeInfoContainer.setGrammarEndAllowed( true );
}
}
Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2/ETypeInfo2Grammar.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2/ETypeInfo2Grammar.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2/ETypeInfo2Grammar.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2/ETypeInfo2Grammar.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.etypeInfo2;
+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.codec.etypeInfo2.actions.AddETypeInfo2Entry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -34,10 +34,10 @@ import org.slf4j.LoggerFactory;
* This class implements the ETYPE-INFO2 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 ETypeInfo2Grammar extends AbstractGrammar
+public final class ETypeInfo2Grammar extends AbstractGrammar<ETypeInfo2Container>
{
/** The logger */
static final Logger LOG = LoggerFactory.getLogger( ETypeInfo2Grammar.class );
@@ -46,12 +46,13 @@ public final class ETypeInfo2Grammar ext
static final boolean IS_DEBUG = LOG.isDebugEnabled();
/** The instance of grammar. ETypeInfo2Grammar is a singleton */
- private static Grammar instance = new ETypeInfo2Grammar();
+ private static Grammar<ETypeInfo2Container> instance = new ETypeInfo2Grammar();
/**
* Creates a new ETypeInfo2Grammar object.
*/
+ @SuppressWarnings("unchecked")
private ETypeInfo2Grammar()
{
setName( ETypeInfo2Grammar.class.getName() );
@@ -60,33 +61,39 @@ public final class ETypeInfo2Grammar ext
super.transitions = new GrammarTransition[ETypeInfo2StatesEnum.LAST_ETYPE_INFO2_STATE.ordinal()][256];
// ============================================================================================
- // ETYPE-INFO2
+ // ETYPE-INFO2
// ============================================================================================
// --------------------------------------------------------------------------------------------
// Transition from ETYPE-INFO2 init to ETYPE-INFO2 SEQ
// --------------------------------------------------------------------------------------------
// ETYPE-INFO2-ENTRY ::= SEQUENCE
- super.transitions[ETypeInfo2StatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
- ETypeInfo2StatesEnum.START_STATE, ETypeInfo2StatesEnum.ETYPE_INFO2_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
- new CheckNotNullLength() );
-
+ super.transitions[ETypeInfo2StatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+ new GrammarTransition<ETypeInfo2Container>(
+ ETypeInfo2StatesEnum.START_STATE,
+ ETypeInfo2StatesEnum.ETYPE_INFO2_SEQ_STATE,
+ UniversalTag.SEQUENCE.getValue(),
+ new CheckNotNullLength<ETypeInfo2Container>() );
+
// --------------------------------------------------------------------------------------------
// Transition from ETYPE-INFO2 init to ETYPE-INFO2 SEQ
// --------------------------------------------------------------------------------------------
// ETYPE-INFO2-ENTRY ::= SEQUENCE OF <ETYPE-INFO2-ENTRY>
- //
- super.transitions[ETypeInfo2StatesEnum.ETYPE_INFO2_SEQ_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
- ETypeInfo2StatesEnum.ETYPE_INFO2_SEQ_STATE, ETypeInfo2StatesEnum.ETYPE_INFO2_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
- new AddETypeInfo2Entry() );
+ //
+ super.transitions[ETypeInfo2StatesEnum.ETYPE_INFO2_SEQ_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+ new GrammarTransition<ETypeInfo2Container>(
+ ETypeInfo2StatesEnum.ETYPE_INFO2_SEQ_STATE,
+ ETypeInfo2StatesEnum.ETYPE_INFO2_SEQ_STATE,
+ UniversalTag.SEQUENCE.getValue(),
+ new AddETypeInfo2Entry() );
}
/**
* Get the instance of this grammar
- *
+ *
* @return An instance on the ETYPE-INFO Grammar
*/
- public static Grammar getInstance()
+ public static Grammar<ETypeInfo2Container> getInstance()
{
return instance;
}
Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2/ETypeInfo2StatesEnum.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2/ETypeInfo2StatesEnum.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2/ETypeInfo2StatesEnum.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2/ETypeInfo2StatesEnum.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.etypeInfo2;
@@ -27,23 +27,23 @@ import org.apache.directory.shared.asn1.
/**
* This class store the ETYPE-INFO2 grammar's constants. It is also used for debugging
* purpose
- *
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
public enum ETypeInfo2StatesEnum implements States
{
// Start
START_STATE, // 0
-
+
ETYPE_INFO2_SEQ_STATE, // 1
-
+
// End
LAST_ETYPE_INFO2_STATE; // 2
-
+
/**
* Get the grammar name
- *
+ *
* @param grammar The grammar code
* @return The grammar name
*/
@@ -55,11 +55,11 @@ public enum ETypeInfo2StatesEnum impleme
/**
* Get the grammar name
- *
+ *
* @param grammar The grammar class
* @return The grammar name
*/
- public String getGrammarName( Grammar grammar )
+ public String getGrammarName( Grammar<ETypeInfo2Container> grammar )
{
if ( grammar instanceof ETypeInfo2Grammar )
{
@@ -74,7 +74,7 @@ public enum ETypeInfo2StatesEnum impleme
/**
* Get the string representing the state
- *
+ *
* @param state The state number
* @return The String representing the state
*/
@@ -83,7 +83,7 @@ public enum ETypeInfo2StatesEnum impleme
return ( ( state == LAST_ETYPE_INFO2_STATE.ordinal() ) ? "LAST_ETYPE_INFO2_STATE" : name() );
}
-
+
/**
* {@inheritDoc}
*/
@@ -91,8 +91,8 @@ public enum ETypeInfo2StatesEnum impleme
{
return this == LAST_ETYPE_INFO2_STATE;
}
-
-
+
+
/**
* {@inheritDoc}
*/
Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2/actions/AddETypeInfo2Entry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2/actions/AddETypeInfo2Entry.java?rev=1068124&r1=1068123&r2=1068124&view=diff
==============================================================================
--- directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2/actions/AddETypeInfo2Entry.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2/actions/AddETypeInfo2Entry.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.etypeInfo2.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 ETypeInfo2Entry object
- *
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class AddETypeInfo2Entry extends GrammarAction
+public class AddETypeInfo2Entry extends GrammarAction<ETypeInfo2Container>
{
/** The logger */
private static final Logger LOG = LoggerFactory.getLogger( AddETypeInfo2Entry.class );
@@ -59,11 +58,9 @@ public class AddETypeInfo2Entry extends
/**
* {@inheritDoc}
*/
- public void action( Asn1Container container ) throws DecoderException
+ public void action( ETypeInfo2Container eTypeInfo2Container ) throws DecoderException
{
- ETypeInfo2Container etypeInfo2Container = ( ETypeInfo2Container ) container;
-
- TLV tlv = etypeInfo2Container.getCurrentTLV();
+ TLV tlv = eTypeInfo2Container.getCurrentTLV();
// The Length should not be null
if ( tlv.getLength() == 0 )
@@ -73,43 +70,43 @@ public class AddETypeInfo2Entry extends
// This will generate a PROTOCOL_ERROR
throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
}
-
+
// Now, let's decode the ETYPE-INFO2-ENTRY
Asn1Decoder etypeInfo2EntryDecoder = new Asn1Decoder();
-
+
ETypeInfo2EntryContainer etypeInfo2EntryContainer = new ETypeInfo2EntryContainer();
- etypeInfo2EntryContainer.setStream( container.getStream() );
-
- // Compute the start position in the stream for the ETypeInfoEntry to decode :
+ etypeInfo2EntryContainer.setStream( eTypeInfo2Container.getStream() );
+
+ // Compute the start position in the stream for the ETypeInfoEntry to decode :
// We have to move back to the ETypeInfoEntry tag
- container.rewind();
+ eTypeInfo2Container.rewind();
// Decode the ETypeInfo2Entry PDU
try
{
- etypeInfo2EntryDecoder.decode( container.getStream(), etypeInfo2EntryContainer );
+ etypeInfo2EntryDecoder.decode( eTypeInfo2Container.getStream(), etypeInfo2EntryContainer );
}
catch ( DecoderException de )
{
throw de;
}
-
+
// Update the expected length for the current TLV
tlv.setExpectedLength( tlv.getExpectedLength() - tlv.getLength() );
// Update the parent
- container.updateParent();
+ eTypeInfo2Container.updateParent();
// Store the ETypeInfoEntry in the container
ETypeInfo2Entry etypeInfo2Entry = etypeInfo2EntryContainer.getETypeInfo2Entry();
- etypeInfo2Container.addEtypeInfo2Entry( etypeInfo2Entry );
-
+ eTypeInfo2Container.addEtypeInfo2Entry( etypeInfo2Entry );
+
if ( IS_DEBUG )
{
LOG.debug( "ETYPE-INFO2-ENTRY added : {}", etypeInfo2Entry );
}
-
- container.setGrammarEndAllowed( true );
+
+ eTypeInfo2Container.setGrammarEndAllowed( true );
}
}
Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2Entry/ETypeInfo2EntryGrammar.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2Entry/ETypeInfo2EntryGrammar.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/ETypeInfo2EntryGrammar.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2Entry/ETypeInfo2EntryGrammar.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.etypeInfo2Entry;
+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.etypeInfo2Entry.actions.ETypeInfo2EntryInit;
import org.apache.directory.shared.kerberos.codec.etypeInfo2Entry.actions.StoreEType;
@@ -38,10 +38,10 @@ import org.slf4j.LoggerFactory;
* This class implements the ETYPE-INFO2-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 ETypeInfo2EntryGrammar extends AbstractGrammar
+public final class ETypeInfo2EntryGrammar extends AbstractGrammar<ETypeInfo2EntryContainer>
{
/** The logger */
static final Logger LOG = LoggerFactory.getLogger( ETypeInfo2EntryGrammar.class );
@@ -50,12 +50,13 @@ public final class ETypeInfo2EntryGramma
static final boolean IS_DEBUG = LOG.isDebugEnabled();
/** The instance of grammar. ETypeInfo2EntryGrammar is a singleton */
- private static Grammar instance = new ETypeInfo2EntryGrammar();
+ private static Grammar<ETypeInfo2EntryContainer> instance = new ETypeInfo2EntryGrammar();
/**
* Creates a new ETypeInfoEntryGrammar object.
*/
+ @SuppressWarnings("unchecked")
private ETypeInfo2EntryGrammar()
{
setName( ETypeInfo2EntryGrammar.class.getName() );
@@ -64,53 +65,68 @@ public final class ETypeInfo2EntryGramma
super.transitions = new GrammarTransition[ETypeInfo2EntryStatesEnum.LAST_ETYPE_INFO2_ENTRY_STATE.ordinal()][256];
// ============================================================================================
- // ETYPE-INFO2-ENTRY
+ // ETYPE-INFO2-ENTRY
// ============================================================================================
// --------------------------------------------------------------------------------------------
// Transition from ETYPE-INFO2-ENTRY init to ETYPE-INFO2-ENTRY SEQ
// --------------------------------------------------------------------------------------------
// ETYPE-INFO2-ENTRY ::= SEQUENCE {
- super.transitions[ETypeInfo2EntryStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
- ETypeInfo2EntryStatesEnum.START_STATE, ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
- new ETypeInfo2EntryInit() );
-
+ super.transitions[ETypeInfo2EntryStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
+ new GrammarTransition<ETypeInfo2EntryContainer>(
+ ETypeInfo2EntryStatesEnum.START_STATE,
+ ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_SEQ_STATE,
+ UniversalTag.SEQUENCE.getValue(),
+ new ETypeInfo2EntryInit() );
+
// --------------------------------------------------------------------------------------------
// Transition from ETYPE-INFO2-ENTRY SEQ to etype tag
// --------------------------------------------------------------------------------------------
// ETYPE-INFO2-ENTRY ::= SEQUENCE {
// etype [0]
- super.transitions[ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_SEQ_STATE.ordinal()][KerberosConstants.ETYPE_INFO2_ENTRY_ETYPE_TAG] = new GrammarTransition(
- ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_SEQ_STATE, ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_ETYPE_TAG_STATE, KerberosConstants.ETYPE_INFO2_ENTRY_ETYPE_TAG,
- new CheckNotNullLength()) ;
-
+ super.transitions[ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_SEQ_STATE.ordinal()][KerberosConstants.ETYPE_INFO2_ENTRY_ETYPE_TAG] =
+ new GrammarTransition<ETypeInfo2EntryContainer>(
+ ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_SEQ_STATE,
+ ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_ETYPE_TAG_STATE,
+ KerberosConstants.ETYPE_INFO2_ENTRY_ETYPE_TAG,
+ new CheckNotNullLength<ETypeInfo2EntryContainer>() );
+
// --------------------------------------------------------------------------------------------
// Transition from etype tag to etype value
// --------------------------------------------------------------------------------------------
// ETYPE-INFO2-ENTRY ::= SEQUENCE {
// etype [0] Int32,
- super.transitions[ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_ETYPE_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] = new GrammarTransition(
- ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_ETYPE_TAG_STATE, ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_ETYPE_STATE, UniversalTag.INTEGER.getValue(),
- new StoreEType() );
-
+ super.transitions[ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_ETYPE_TAG_STATE.ordinal()][UniversalTag.INTEGER.getValue()] =
+ new GrammarTransition<ETypeInfo2EntryContainer>(
+ ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_ETYPE_TAG_STATE,
+ ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_ETYPE_STATE,
+ UniversalTag.INTEGER.getValue(),
+ new StoreEType() );
+
// --------------------------------------------------------------------------------------------
// Transition from etype value to salt tag
// --------------------------------------------------------------------------------------------
// ETYPE-INFO2-ENTRY ::= SEQUENCE {
// ...
// salt [1]
- super.transitions[ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_ETYPE_STATE.ordinal()][KerberosConstants.ETYPE_INFO2_ENTRY_SALT_TAG] = new GrammarTransition(
- ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_ETYPE_STATE, ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_SALT_TAG_STATE, KerberosConstants.ETYPE_INFO2_ENTRY_SALT_TAG,
- new CheckNotNullLength() );
-
+ super.transitions[ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_ETYPE_STATE.ordinal()][KerberosConstants.ETYPE_INFO2_ENTRY_SALT_TAG] =
+ new GrammarTransition<ETypeInfo2EntryContainer>(
+ ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_ETYPE_STATE,
+ ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_SALT_TAG_STATE,
+ KerberosConstants.ETYPE_INFO2_ENTRY_SALT_TAG,
+ new CheckNotNullLength<ETypeInfo2EntryContainer>() );
+
// --------------------------------------------------------------------------------------------
// Transition from etype value to s2kparams tag
// --------------------------------------------------------------------------------------------
// ETYPE-INFO2-ENTRY ::= SEQUENCE {
// ...
// s2kparams [2]
- super.transitions[ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_ETYPE_STATE.ordinal()][KerberosConstants.ETYPE_INFO2_ENTRY_S2KPARAMS_TAG] = new GrammarTransition(
- ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_ETYPE_STATE, ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_S2KPARAMS_TAG_STATE, KerberosConstants.ETYPE_INFO2_ENTRY_S2KPARAMS_TAG,
- new CheckNotNullLength() );
+ super.transitions[ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_ETYPE_STATE.ordinal()][KerberosConstants.ETYPE_INFO2_ENTRY_S2KPARAMS_TAG] =
+ new GrammarTransition<ETypeInfo2EntryContainer>(
+ ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_ETYPE_STATE,
+ ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_S2KPARAMS_TAG_STATE,
+ KerberosConstants.ETYPE_INFO2_ENTRY_S2KPARAMS_TAG,
+ new CheckNotNullLength<ETypeInfo2EntryContainer>() );
// --------------------------------------------------------------------------------------------
// Transition from salt tag to salt value
@@ -118,19 +134,25 @@ public final class ETypeInfo2EntryGramma
// ETYPE-INFO2-ENTRY ::= SEQUENCE {
// ...
// salt [1] KerberosString OPTIONAL,
- super.transitions[ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_SALT_TAG_STATE.ordinal()][UniversalTag.GENERAL_STRING.getValue()] = new GrammarTransition(
- ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_SALT_TAG_STATE, ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_SALT_STATE, UniversalTag.GENERAL_STRING.getValue(),
- new StoreSalt() );
-
+ super.transitions[ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_SALT_TAG_STATE.ordinal()][UniversalTag.GENERAL_STRING.getValue()] =
+ new GrammarTransition<ETypeInfo2EntryContainer>(
+ ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_SALT_TAG_STATE,
+ ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_SALT_STATE,
+ UniversalTag.GENERAL_STRING.getValue(),
+ new StoreSalt() );
+
// --------------------------------------------------------------------------------------------
- // Transition from salt value to s2kparams tag
+ // Transition from salt value to s2kparams tag
// --------------------------------------------------------------------------------------------
// ETYPE-INFO2-ENTRY ::= SEQUENCE {
// ...
// s2kparams [2]
- super.transitions[ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_SALT_STATE.ordinal()][KerberosConstants.ETYPE_INFO2_ENTRY_S2KPARAMS_TAG] = new GrammarTransition(
- ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_SALT_STATE, ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_S2KPARAMS_TAG_STATE, KerberosConstants.ETYPE_INFO2_ENTRY_S2KPARAMS_TAG,
- new CheckNotNullLength() );
+ super.transitions[ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_SALT_STATE.ordinal()][KerberosConstants.ETYPE_INFO2_ENTRY_S2KPARAMS_TAG] =
+ new GrammarTransition<ETypeInfo2EntryContainer>(
+ ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_SALT_STATE,
+ ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_S2KPARAMS_TAG_STATE,
+ KerberosConstants.ETYPE_INFO2_ENTRY_S2KPARAMS_TAG,
+ new CheckNotNullLength<ETypeInfo2EntryContainer>() );
// --------------------------------------------------------------------------------------------
// Transition from s2kparams tag to s2kparams value
@@ -138,18 +160,21 @@ public final class ETypeInfo2EntryGramma
// ETYPE-INFO2-ENTRY ::= SEQUENCE {
// ...
// s2kparams [2] OCTET STRING OPTIONAL
- super.transitions[ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_S2KPARAMS_TAG_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
- ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_S2KPARAMS_TAG_STATE, ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_S2KPARAMS_STATE, UniversalTag.OCTET_STRING.getValue(),
- new StoreS2KParams() );
+ super.transitions[ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_S2KPARAMS_TAG_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] =
+ new GrammarTransition<ETypeInfo2EntryContainer>(
+ ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_S2KPARAMS_TAG_STATE,
+ ETypeInfo2EntryStatesEnum.ETYPE_INFO2_ENTRY_S2KPARAMS_STATE,
+ UniversalTag.OCTET_STRING.getValue(),
+ new StoreS2KParams() );
}
/**
* Get the instance of this grammar
- *
+ *
* @return An instance on the ETYPE-INFO2-ENTRY Grammar
*/
- public static Grammar getInstance()
+ public static Grammar<ETypeInfo2EntryContainer> getInstance()
{
return instance;
}
Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2Entry/ETypeInfo2EntryStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2Entry/ETypeInfo2EntryStatesEnum.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/ETypeInfo2EntryStatesEnum.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2Entry/ETypeInfo2EntryStatesEnum.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.etypeInfo2Entry;
@@ -27,35 +27,35 @@ import org.apache.directory.shared.asn1.
/**
* This class store the ETYPE-INFO2-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 ETypeInfo2EntryStatesEnum implements States
{
// Start
START_STATE, // 0
-
+
ETYPE_INFO2_ENTRY_SEQ_STATE, // 1
-
+
ETYPE_INFO2_ENTRY_ETYPE_TAG_STATE, // 2
-
+
ETYPE_INFO2_ENTRY_ETYPE_STATE, // 3
-
+
ETYPE_INFO2_ENTRY_SALT_TAG_STATE, // 4
-
+
ETYPE_INFO2_ENTRY_SALT_STATE, // 5
-
+
ETYPE_INFO2_ENTRY_S2KPARAMS_TAG_STATE, // 6
-
+
ETYPE_INFO2_ENTRY_S2KPARAMS_STATE, // 7
-
+
// End
LAST_ETYPE_INFO2_ENTRY_STATE; // 8
-
+
/**
* Get the grammar name
- *
+ *
* @param grammar The grammar code
* @return The grammar name
*/
@@ -67,11 +67,11 @@ public enum ETypeInfo2EntryStatesEnum im
/**
* Get the grammar name
- *
+ *
* @param grammar The grammar class
* @return The grammar name
*/
- public String getGrammarName( Grammar grammar )
+ public String getGrammarName( Grammar<ETypeInfo2EntryContainer> grammar )
{
if ( grammar instanceof ETypeInfo2EntryGrammar )
{
@@ -86,7 +86,7 @@ public enum ETypeInfo2EntryStatesEnum im
/**
* Get the string representing the state
- *
+ *
* @param state The state number
* @return The String representing the state
*/
@@ -95,7 +95,7 @@ public enum ETypeInfo2EntryStatesEnum im
return ( ( state == LAST_ETYPE_INFO2_ENTRY_STATE.ordinal() ) ? "LAST_ETYPE_INFO2_ENTRY_STATE" : name() );
}
-
+
/**
* {@inheritDoc}
*/
@@ -103,8 +103,8 @@ public enum ETypeInfo2EntryStatesEnum im
{
return this == LAST_ETYPE_INFO2_ENTRY_STATE;
}
-
-
+
+
/**
* {@inheritDoc}
*/
Modified: directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2Entry/actions/ETypeInfo2EntryInit.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2Entry/actions/ETypeInfo2EntryInit.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/ETypeInfo2EntryInit.java (original)
+++ directory/apacheds/branches/m1/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/etypeInfo2Entry/actions/ETypeInfo2EntryInit.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.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.DecoderException;
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.kerberos.codec.etypeInfo2Entry.ETypeInfo2EntryContainer;
import org.apache.directory.shared.kerberos.components.ETypeInfo2Entry;
@@ -33,10 +32,10 @@ import org.slf4j.LoggerFactory;
/**
* The action used to initialize the ETYPE-INFO2-ENTRY object
- *
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class ETypeInfo2EntryInit extends GrammarAction
+public class ETypeInfo2EntryInit extends GrammarAction<ETypeInfo2EntryContainer>
{
/** The logger */
private static final Logger LOG = LoggerFactory.getLogger( ETypeInfo2EntryInit.class );
@@ -57,11 +56,9 @@ public class ETypeInfo2EntryInit extends
/**
* {@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 )
@@ -71,10 +68,10 @@ public class ETypeInfo2EntryInit extends
// This will generate a PROTOCOL_ERROR
throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
}
-
+
ETypeInfo2Entry etypeInfo2Entry = new ETypeInfo2Entry();
- etypeInfo2EntryContainer.setETypeInfo2Entry( etypeInfo2Entry );
-
+ eTypeInfo2EntryContainer.setETypeInfo2Entry( etypeInfo2Entry );
+
if ( IS_DEBUG )
{
LOG.debug( "ETYPE-INFO2-ENTRY created" );
|