directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1039697 - in /directory: apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/ apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adAndOr/actions/ apacheds/trunk...
Date Sat, 27 Nov 2010 15:29:43 GMT
Author: elecharny
Date: Sat Nov 27 15:29:42 2010
New Revision: 1039697

URL: http://svn.apache.org/viewvc?rev=1039697&view=rev
Log:
o Added a constant in Asn1Decoder used by all the decoder loggers
o Used the AbstractReadAuthorizationData when useful

Modified:
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadAuthorizationData.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadCheckSum.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadEncryptedPart.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadEncryptionKey.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadHostAddress.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadHostAddresses.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadKerberosTime.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadMsgType.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadPrincipalName.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadPvno.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadRealm.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adAndOr/actions/StoreElements.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreElements.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/codec/actions/AbstractReadByteArray.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/codec/actions/AbstractReadInteger.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/codec/actions/CheckNotNullLength.java

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadAuthorizationData.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadAuthorizationData.java?rev=1039697&r1=1039696&r2=1039697&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadAuthorizationData.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadAuthorizationData.java
Sat Nov 27 15:29:42 2010
@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
 public abstract class AbstractReadAuthorizationData extends GrammarAction
 {
     /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( AbstractReadAuthorizationData.class
);
+    private static final Logger LOG = LoggerFactory.getLogger( Asn1Decoder.ASN1_DECODER );
 
     /** Speedup for logs */
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadCheckSum.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadCheckSum.java?rev=1039697&r1=1039696&r2=1039697&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadCheckSum.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadCheckSum.java
Sat Nov 27 15:29:42 2010
@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
 public abstract class AbstractReadCheckSum extends GrammarAction
 {
     /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( AbstractReadCheckSum.class
);
+    private static final Logger LOG = LoggerFactory.getLogger( Asn1Decoder.ASN1_DECODER );
 
     /** Speedup for logs */
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadEncryptedPart.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadEncryptedPart.java?rev=1039697&r1=1039696&r2=1039697&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadEncryptedPart.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadEncryptedPart.java
Sat Nov 27 15:29:42 2010
@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
 public abstract class AbstractReadEncryptedPart extends GrammarAction
 {
     /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( "ASN1-DECODER" );
+    private static final Logger LOG = LoggerFactory.getLogger( Asn1Decoder.ASN1_DECODER );
 
     /** Speedup for logs */
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadEncryptionKey.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadEncryptionKey.java?rev=1039697&r1=1039696&r2=1039697&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadEncryptionKey.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadEncryptionKey.java
Sat Nov 27 15:29:42 2010
@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
 public abstract class AbstractReadEncryptionKey extends GrammarAction
 {
     /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( AbstractReadEncryptionKey.class
);
+    private static final Logger LOG = LoggerFactory.getLogger( Asn1Decoder.ASN1_DECODER );
 
     /** Speedup for logs */
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadHostAddress.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadHostAddress.java?rev=1039697&r1=1039696&r2=1039697&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadHostAddress.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadHostAddress.java
Sat Nov 27 15:29:42 2010
@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
 public abstract class AbstractReadHostAddress extends GrammarAction
 {
     /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( AbstractReadHostAddress.class
);
+    private static final Logger LOG = LoggerFactory.getLogger( Asn1Decoder.ASN1_DECODER );
 
     /** Speedup for logs */
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadHostAddresses.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadHostAddresses.java?rev=1039697&r1=1039696&r2=1039697&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadHostAddresses.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadHostAddresses.java
Sat Nov 27 15:29:42 2010
@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
 public abstract class AbstractReadHostAddresses extends GrammarAction
 {
     /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( AbstractReadHostAddresses.class
);
+    private static final Logger LOG = LoggerFactory.getLogger( Asn1Decoder.ASN1_DECODER );
 
     /** Speedup for logs */
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadKerberosTime.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadKerberosTime.java?rev=1039697&r1=1039696&r2=1039697&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadKerberosTime.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadKerberosTime.java
Sat Nov 27 15:29:42 2010
@@ -21,6 +21,7 @@ package org.apache.directory.shared.kerb
 
 
 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;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
@@ -40,7 +41,7 @@ import org.slf4j.LoggerFactory;
 public abstract class AbstractReadKerberosTime extends GrammarAction
 {
     /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( AbstractReadKerberosTime.class
);
+    private static final Logger LOG = LoggerFactory.getLogger( Asn1Decoder.ASN1_DECODER );
 
     /** Speedup for logs */
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadMsgType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadMsgType.java?rev=1039697&r1=1039696&r2=1039697&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadMsgType.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadMsgType.java
Sat Nov 27 15:29:42 2010
@@ -21,6 +21,7 @@ package org.apache.directory.shared.kerb
 
 
 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;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
@@ -42,7 +43,7 @@ import org.slf4j.LoggerFactory;
 public abstract class AbstractReadMsgType extends GrammarAction
 {
     /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( AbstractReadMsgType.class
);
+    private static final Logger LOG = LoggerFactory.getLogger( Asn1Decoder.ASN1_DECODER );
 
     /** Speedup for logs */
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadPrincipalName.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadPrincipalName.java?rev=1039697&r1=1039696&r2=1039697&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadPrincipalName.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadPrincipalName.java
Sat Nov 27 15:29:42 2010
@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
 public abstract class AbstractReadPrincipalName extends GrammarAction
 {
     /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( AbstractReadPrincipalName.class
);
+    private static final Logger LOG = LoggerFactory.getLogger( Asn1Decoder.ASN1_DECODER );
 
     /** Speedup for logs */
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadPvno.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadPvno.java?rev=1039697&r1=1039696&r2=1039697&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadPvno.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadPvno.java
Sat Nov 27 15:29:42 2010
@@ -21,6 +21,7 @@ package org.apache.directory.shared.kerb
 
 
 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;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
@@ -41,7 +42,7 @@ import org.slf4j.LoggerFactory;
 public abstract class AbstractReadPvno extends GrammarAction
 {
     /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( AbstractReadPvno.class );
+    private static final Logger LOG = LoggerFactory.getLogger( Asn1Decoder.ASN1_DECODER );
 
     /** Speedup for logs */
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadRealm.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadRealm.java?rev=1039697&r1=1039696&r2=1039697&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadRealm.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/actions/AbstractReadRealm.java
Sat Nov 27 15:29:42 2010
@@ -21,6 +21,7 @@ package org.apache.directory.shared.kerb
 
 
 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;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
@@ -39,7 +40,7 @@ import org.slf4j.LoggerFactory;
 public abstract class AbstractReadRealm extends GrammarAction
 {
     /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( AbstractReadRealm.class );
+    private static final Logger LOG = LoggerFactory.getLogger( Asn1Decoder.ASN1_DECODER );
 
     /** Speedup for logs */
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adAndOr/actions/StoreElements.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adAndOr/actions/StoreElements.java?rev=1039697&r1=1039696&r2=1039697&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adAndOr/actions/StoreElements.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adAndOr/actions/StoreElements.java
Sat Nov 27 15:29:42 2010
@@ -21,16 +21,9 @@ package org.apache.directory.shared.kerb
 
 
 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;
-import org.apache.directory.shared.asn1.codec.DecoderException;
-import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.kerberos.codec.actions.AbstractReadAuthorizationData;
 import org.apache.directory.shared.kerberos.codec.adAndOr.AdAndOrContainer;
-import org.apache.directory.shared.kerberos.codec.authorizationData.AuthorizationDataContainer;
 import org.apache.directory.shared.kerberos.components.AuthorizationData;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 
 /**
@@ -38,15 +31,8 @@ import org.slf4j.LoggerFactory;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreElements extends GrammarAction
+public class StoreElements extends AbstractReadAuthorizationData
 {
-    /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( StoreElements.class );
-
-    /** Speedup for logs */
-    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
-
-
     /**
      * Instantiates a new StoreElements action.
      */
@@ -59,53 +45,11 @@ public class StoreElements extends Gramm
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    @Override
+    protected void setAuthorizationData( AuthorizationData authorizationData, Asn1Container
container )
     {
         AdAndOrContainer adAndOrContainer = ( AdAndOrContainer ) container;
-
-        TLV tlv = adAndOrContainer.getCurrentTLV();
-
-        // The Length should not be null
-        if ( tlv.getLength() == 0 )
-        {
-            LOG.error( I18n.err( I18n.ERR_04066 ) );
-
-            // This will generate a PROTOCOL_ERROR
-            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
-        }
-        
-        // Now, let's decode the AuthorizationData
-        Asn1Decoder authorizationDataDecoder = new Asn1Decoder();
-        
-        AuthorizationDataContainer authorizationDataContainer = new AuthorizationDataContainer();
-        authorizationDataContainer.setStream( container.getStream() );
-        
-        // Decode the AuthorizationData PDU
-        try
-        {
-            authorizationDataDecoder.decode( container.getStream(), authorizationDataContainer
);
-        }
-        catch ( DecoderException de )
-        {
-            throw de;
-        }
-        
-        // Update the expected length for the current TLV
-        tlv.setExpectedLength( tlv.getExpectedLength() - tlv.getLength() );
-
-        // Update the parent
-        container.updateParent();
-
-        // Store the AuthorizationData in the container
-        AuthorizationData elements = authorizationDataContainer.getAuthorizationData();
-        adAndOrContainer.getAdAndOr().setElements( elements );
-        
-
-        if ( IS_DEBUG )
-        {
-            LOG.debug( "Elements added : {}", elements );
-        }
-        
-        container.setGrammarEndAllowed( true );
+        adAndOrContainer.getAdAndOr().setElements( authorizationData );
+        adAndOrContainer.setGrammarEndAllowed( true );
     }
 }

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreElements.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreElements.java?rev=1039697&r1=1039696&r2=1039697&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreElements.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/adKdcIssued/actions/StoreElements.java
Sat Nov 27 15:29:42 2010
@@ -21,16 +21,9 @@ package org.apache.directory.shared.kerb
 
 
 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;
-import org.apache.directory.shared.asn1.codec.DecoderException;
-import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.kerberos.codec.actions.AbstractReadAuthorizationData;
 import org.apache.directory.shared.kerberos.codec.adKdcIssued.AdKdcIssuedContainer;
-import org.apache.directory.shared.kerberos.codec.authorizationData.AuthorizationDataContainer;
 import org.apache.directory.shared.kerberos.components.AuthorizationData;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 
 /**
@@ -38,15 +31,8 @@ import org.slf4j.LoggerFactory;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreElements extends GrammarAction
+public class StoreElements extends AbstractReadAuthorizationData
 {
-    /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( StoreElements.class );
-
-    /** Speedup for logs */
-    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
-
-
     /**
      * Instantiates a new StoreElements action.
      */
@@ -59,53 +45,11 @@ public class StoreElements extends Gramm
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    @Override
+    protected void setAuthorizationData( AuthorizationData authorizationData, Asn1Container
container )
     {
         AdKdcIssuedContainer adKdcIssuedContainer = ( AdKdcIssuedContainer ) container;
-
-        TLV tlv = adKdcIssuedContainer.getCurrentTLV();
-
-        // The Length should not be null
-        if ( tlv.getLength() == 0 )
-        {
-            LOG.error( I18n.err( I18n.ERR_04066 ) );
-
-            // This will generate a PROTOCOL_ERROR
-            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
-        }
-        
-        // Now, let's decode the AuthorizationData
-        Asn1Decoder authorizationDataDecoder = new Asn1Decoder();
-        
-        AuthorizationDataContainer authorizationDataContainer = new AuthorizationDataContainer();
-        authorizationDataContainer.setStream( container.getStream() );
-        
-        // Decode the AuthorizationData PDU
-        try
-        {
-            authorizationDataDecoder.decode( container.getStream(), authorizationDataContainer
);
-        }
-        catch ( DecoderException de )
-        {
-            throw de;
-        }
-        
-        // Update the expected length for the current TLV
-        tlv.setExpectedLength( tlv.getExpectedLength() - tlv.getLength() );
-
-        // Update the parent
-        container.updateParent();
-
-        // Store the AuthorizationData in the container
-        AuthorizationData elements = authorizationDataContainer.getAuthorizationData();
-        adKdcIssuedContainer.getAdKdcIssued().setElements( elements );
-        
-
-        if ( IS_DEBUG )
-        {
-            LOG.debug( "Elements added : {}", elements );
-        }
-        
-        container.setGrammarEndAllowed( true );
+        adKdcIssuedContainer.getAdKdcIssued().setElements( authorizationData );
+        adKdcIssuedContainer.setGrammarEndAllowed( true );
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java?rev=1039697&r1=1039696&r2=1039697&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java
Sat Nov 27 15:29:42 2010
@@ -42,8 +42,11 @@ import org.slf4j.LoggerFactory;
 */
 public class Asn1Decoder implements TLVBerDecoderMBean
 {
+    /** A public constant used by all the ASN1 decoder */
+    public static final String ASN1_DECODER = "ASN1-DECODER";
+    
     /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( Asn1Decoder.class );
+    private static final Logger LOG = LoggerFactory.getLogger( ASN1_DECODER );
 
     /** A speedup for logger */
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/codec/actions/AbstractReadByteArray.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/codec/actions/AbstractReadByteArray.java?rev=1039697&r1=1039696&r2=1039697&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/codec/actions/AbstractReadByteArray.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/codec/actions/AbstractReadByteArray.java
Sat Nov 27 15:29:42 2010
@@ -21,6 +21,7 @@ package org.apache.directory.shared.asn1
 
 
 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;
 import org.apache.directory.shared.asn1.codec.DecoderException;
@@ -38,7 +39,7 @@ import org.slf4j.LoggerFactory;
 public abstract class AbstractReadByteArray extends GrammarAction
 {
     /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( "ASN1-DECODER" );
+    private static final Logger LOG = LoggerFactory.getLogger( Asn1Decoder.ASN1_DECODER );
 
     /** Speedup for logs */
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/codec/actions/AbstractReadInteger.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/codec/actions/AbstractReadInteger.java?rev=1039697&r1=1039696&r2=1039697&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/codec/actions/AbstractReadInteger.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/codec/actions/AbstractReadInteger.java
Sat Nov 27 15:29:42 2010
@@ -21,6 +21,7 @@ package org.apache.directory.shared.asn1
 
 
 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;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
@@ -41,7 +42,7 @@ import org.slf4j.LoggerFactory;
 public abstract class AbstractReadInteger extends GrammarAction
 {
     /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( "ASN1-DECODER" );
+    private static final Logger LOG = LoggerFactory.getLogger( Asn1Decoder.ASN1_DECODER );
 
     /** Speedup for logs */
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/codec/actions/CheckNotNullLength.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/codec/actions/CheckNotNullLength.java?rev=1039697&r1=1039696&r2=1039697&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/codec/actions/CheckNotNullLength.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/asn1/codec/actions/CheckNotNullLength.java
Sat Nov 27 15:29:42 2010
@@ -21,6 +21,7 @@ package org.apache.directory.shared.asn1
 
 
 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;
 import org.apache.directory.shared.asn1.codec.DecoderException;
@@ -37,7 +38,7 @@ import org.slf4j.LoggerFactory;
 public class CheckNotNullLength extends GrammarAction
 {
     /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( "ASN1-DECODER" );
+    private static final Logger LOG = LoggerFactory.getLogger( Asn1Decoder.ASN1_DECODER );
 
     /**
      * Instantiates the action.



Mime
View raw message