You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2012/01/25 09:48:29 UTC
svn commit: r1235689 - in
/directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1:
actions/ ber/ ber/grammar/
Author: elecharny
Date: Wed Jan 25 08:48:29 2012
New Revision: 1235689
URL: http://svn.apache.org/viewvc?rev=1235689&view=rev
Log:
Updated Javadoc
Modified:
directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadBitString.java
directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadInteger.java
directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadOctetString.java
directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/actions/CheckNotNullLength.java
directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java
directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Container.java
directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java
directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java
directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/Action.java
directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/Grammar.java
directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/GrammarAction.java
Modified: directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadBitString.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadBitString.java?rev=1235689&r1=1235688&r2=1235689&view=diff
==============================================================================
--- directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadBitString.java (original)
+++ directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadBitString.java Wed Jan 25 08:48:29 2012
@@ -32,10 +32,12 @@ import org.slf4j.LoggerFactory;
/**
* The action used read a BITSTRING from a TLV
+ *
+ * @param C The container type
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public abstract class AbstractReadBitString<E extends Asn1Container> extends GrammarAction<E>
+public abstract class AbstractReadBitString<C extends Asn1Container> extends GrammarAction<C>
{
/** The logger */
private static final Logger LOG = LoggerFactory.getLogger( AbstractReadBitString.class );
@@ -46,6 +48,8 @@ public abstract class AbstractReadBitStr
/**
* Instantiates a new AbstractReadByteArray action.
+ *
+ * @param name the action's name
*/
public AbstractReadBitString( String name )
{
@@ -54,19 +58,19 @@ public abstract class AbstractReadBitStr
/**
- * gives a byte array to be set to the appropriate field of the ASN.1 object
+ * Gives a byte array to be set to the appropriate field of the ASN.1 object
* present in the container
*
* @param data the data of the read TLV present in byte array format
* @param container the container holding the ASN.1 object
*/
- protected abstract void setBitString( byte[] data, E container );
+ protected abstract void setBitString( byte[] data, C container );
/**
* {@inheritDoc}
*/
- public final void action( E container ) throws DecoderException
+ public final void action( C container ) throws DecoderException
{
TLV tlv = container.getCurrentTLV();
Modified: directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadInteger.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadInteger.java?rev=1235689&r1=1235688&r2=1235689&view=diff
==============================================================================
--- directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadInteger.java (original)
+++ directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadInteger.java Wed Jan 25 08:48:29 2012
@@ -36,6 +36,8 @@ import org.slf4j.LoggerFactory;
/**
* The action used to read an integer value
*
+ * @param C The container type
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
public abstract class AbstractReadInteger<E extends Asn1Container> extends GrammarAction<E>
@@ -55,6 +57,8 @@ public abstract class AbstractReadIntege
/**
* Instantiates a new AbstractReadInteger action.
+ *
+ * @param name the action's name
*/
public AbstractReadInteger( String name )
{
Modified: directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadOctetString.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadOctetString.java?rev=1235689&r1=1235688&r2=1235689&view=diff
==============================================================================
--- directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadOctetString.java (original)
+++ directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/actions/AbstractReadOctetString.java Wed Jan 25 08:48:29 2012
@@ -33,9 +33,11 @@ import org.slf4j.LoggerFactory;
/**
* The action used to read an OCTET STRING value
*
+ * @param C The container type
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public abstract class AbstractReadOctetString<E extends Asn1Container> extends GrammarAction<E>
+public abstract class AbstractReadOctetString<C extends Asn1Container> extends GrammarAction<C>
{
/** The logger */
private static final Logger LOG = LoggerFactory.getLogger( AbstractReadOctetString.class );
@@ -46,6 +48,8 @@ public abstract class AbstractReadOctetS
/**
* Instantiates a new AbstractReadInteger action.
+ *
+ * @param name the action's name
*/
public AbstractReadOctetString( String name )
{
@@ -56,7 +60,7 @@ public abstract class AbstractReadOctetS
/**
* Instantiates a new AbstractReadInteger action.
*
- * @param name The log message
+ * @param name the action's name
* @param canBeNull Tells if the byte array can be null or not
*/
public AbstractReadOctetString( String name, boolean canBeNull )
@@ -68,19 +72,18 @@ public abstract class AbstractReadOctetS
/**
- *
- * set the OCTET STRING value to the appropriate field of ASN.1 object present in the container
+ * Sets the OCTET STRING value to the appropriate field of ASN.1 object present in the container
*
* @param value the OCTET STRING value
* @param container the ASN.1 object's container
*/
- protected abstract void setOctetString( byte[] value, E container );
+ protected abstract void setOctetString( byte[] value, C container );
/**
* {@inheritDoc}
*/
- public final void action( E container ) throws DecoderException
+ public final void action( C container ) throws DecoderException
{
TLV tlv = container.getCurrentTLV();
Modified: directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/actions/CheckNotNullLength.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/actions/CheckNotNullLength.java?rev=1235689&r1=1235688&r2=1235689&view=diff
==============================================================================
--- directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/actions/CheckNotNullLength.java (original)
+++ directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/actions/CheckNotNullLength.java Wed Jan 25 08:48:29 2012
@@ -32,9 +32,11 @@ import org.slf4j.LoggerFactory;
/**
* An action that checks the length is not null
*
+ * @param C The container type
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class CheckNotNullLength<E extends Asn1Container> extends GrammarAction<E>
+public class CheckNotNullLength<C extends Asn1Container> extends GrammarAction<C>
{
/** The logger */
private static final Logger LOG = LoggerFactory.getLogger( CheckNotNullLength.class );
@@ -52,7 +54,7 @@ public class CheckNotNullLength<E extend
/**
* {@inheritDoc}
*/
- public void action( E container ) throws DecoderException
+ public void action( C container ) throws DecoderException
{
TLV tlv = container.getCurrentTLV();
Modified: directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java?rev=1235689&r1=1235688&r2=1235689&view=diff
==============================================================================
--- directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java (original)
+++ directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java Wed Jan 25 08:48:29 2012
@@ -98,20 +98,17 @@ public abstract class AbstractContainer
/**
- * Get the current grammar
- *
- * @return Returns the grammar used to decode a LdapMessage.
+ * {@inheritDoc}
*/
- public Grammar<?> getGrammar()
+ @SuppressWarnings("rawtypes")
+ public Grammar getGrammar()
{
return grammar;
}
/**
- * Get the current grammar state
- *
- * @return Returns the current grammar state
+ * {@inheritDoc}
*/
public TLVStateEnum getState()
{
@@ -120,9 +117,7 @@ public abstract class AbstractContainer
/**
- * Set the new current state
- *
- * @param state The new state
+ * {@inheritDoc}
*/
public void setState( TLVStateEnum state )
{
@@ -131,9 +126,7 @@ public abstract class AbstractContainer
/**
- * Check that we can have a end state after this transition
- *
- * @return true if this can be the last transition
+ * {@inheritDoc}
*/
public boolean isGrammarEndAllowed()
{
@@ -142,10 +135,7 @@ public abstract class AbstractContainer
/**
- * Set the flag to allow a end transition
- *
- * @param grammarEndAllowed true or false, depending on the next transition
- * being an end or not.
+ * {@inheritDoc}
*/
public void setGrammarEndAllowed( boolean grammarEndAllowed )
{
@@ -154,9 +144,7 @@ public abstract class AbstractContainer
/**
- * Get the transition
- *
- * @return Returns the transition from the previous state to the new state
+ * {@inheritDoc}
*/
public Enum<?> getTransition()
{
@@ -165,9 +153,7 @@ public abstract class AbstractContainer
/**
- * Update the transition from a state to another
- *
- * @param transition The transition to set
+ * {@inheritDoc}
*/
public void setTransition( Enum<?> transition )
{
@@ -176,9 +162,7 @@ public abstract class AbstractContainer
/**
- * Set the current TLV
- *
- * @param currentTLV The current TLV
+ * {@inheritDoc}
*/
public void setCurrentTLV( TLV currentTLV )
{
@@ -187,9 +171,7 @@ public abstract class AbstractContainer
/**
- * Get the current TLV
- *
- * @return Returns the current TLV being decoded
+ * {@inheritDoc}
*/
public TLV getCurrentTLV()
{
@@ -198,9 +180,7 @@ public abstract class AbstractContainer
/**
- * Get the parent TLV;
- *
- * @return Returns the parent TLV, if any.
+ * {@inheritDoc}
*/
public TLV getParentTLV()
{
@@ -209,9 +189,7 @@ public abstract class AbstractContainer
/**
- * Set the parent TLV.
- *
- * @param parentTLV The parent TLV to set.
+ * {@inheritDoc}
*/
public void setParentTLV( TLV parentTLV )
{
@@ -232,8 +210,7 @@ public abstract class AbstractContainer
/**
- * Return a new ID and increment the counter
- * @return A new TLV id.
+ * {@inheritDoc}
*/
public int getNewTlvId()
{
@@ -242,7 +219,7 @@ public abstract class AbstractContainer
/**
- * @return The TLV Id
+ * {@inheritDoc}
*/
public int getTlvId()
{
@@ -251,9 +228,7 @@ public abstract class AbstractContainer
/**
- * @return The number of decoded bytes for this message. This is used
- * to control the PDU size and avoid PDU exceeding the maximum allowed
- * size to break the server.
+ * {@inheritDoc}
*/
public int getDecodeBytes()
{
@@ -262,8 +237,7 @@ public abstract class AbstractContainer
/**
- * Increment the decodedBytes by the latest received buffer's size.
- * @param nb The buffer size.
+ * {@inheritDoc}
*/
public void incrementDecodeBytes( int nb )
{
@@ -272,7 +246,7 @@ public abstract class AbstractContainer
/**
- * @return The maximum PDU size.
+ * {@inheritDoc}
*/
public int getMaxPDUSize()
{
@@ -281,9 +255,7 @@ public abstract class AbstractContainer
/**
- * Set the maximum PDU size.
- * @param maxPDUSize The maximum PDU size (if negative or null, will be
- * replaced by the max integer value)
+ * {@inheritDoc}
*/
public void setMaxPDUSize( int maxPDUSize )
{
Modified: directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Container.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Container.java?rev=1235689&r1=1235688&r2=1235689&view=diff
==============================================================================
--- directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Container.java (original)
+++ directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Container.java Wed Jan 25 08:48:29 2012
@@ -51,7 +51,7 @@ public interface Asn1Container
/**
- * Get the current grammar state
+ * Gets the current grammar state
*
* @return Returns the current grammar state
*/
@@ -59,7 +59,7 @@ public interface Asn1Container
/**
- * Set the new current state
+ * Sets the new current state
*
* @param state The new state
*/
@@ -67,7 +67,7 @@ public interface Asn1Container
/**
- * Get the currentTLV
+ * Gets the currentTLV
*
* @return Returns the current TLV being decoded
*/
@@ -75,7 +75,7 @@ public interface Asn1Container
/**
- * Set the current TLV
+ * Sets the current TLV
*
* @param tlv The current TLV
*/
@@ -83,15 +83,16 @@ public interface Asn1Container
/**
- * Get the grammar
+ * Gets the grammar
*
* @return Returns the grammar used to decode a LdapMessage.
*/
+ @SuppressWarnings("rawtypes")
Grammar getGrammar();
/**
- * Get the transition
+ * Gets the transition
*
* @return Returns the transition from the previous state to the new state
*/
@@ -99,7 +100,7 @@ public interface Asn1Container
/**
- * Update the transition from a state to another
+ * Updates the transition from a state to another
*
* @param transition The transition to set
*/
@@ -107,13 +108,13 @@ public interface Asn1Container
/**
- * @return get the parent TLV.
+ * @return The parent TLV.
*/
TLV getParentTLV();
/**
- * Set the parent TLV
+ * Sets the parent TLV
*
* @param parentTLV The new parent TLV
*/
@@ -121,7 +122,7 @@ public interface Asn1Container
/**
- * Check that we can have a end state after this transition
+ * Checks that we can have a end state after this transition
*
* @return true if this can be the last transition
*/
@@ -129,7 +130,7 @@ public interface Asn1Container
/**
- * Set the flag to allow a end transition
+ * Sets the flag to allow a end transition
*
* @param grammarEndAllowed true or false, depending on the next transition
* being an end or not.
@@ -138,14 +139,14 @@ public interface Asn1Container
/**
- * Get a new TLV id
+ * Gets a new TLV id
* @return a unique value representing the current TLV id
*/
int getNewTlvId();
/**
- * Get the current TLV id
+ * Gets the current TLV id
* @return a unique value representing the current TLV id
*/
int getTlvId();
@@ -184,13 +185,13 @@ public interface Asn1Container
* Move backward in the stream to the first byte for a given TLV. This is useful when we have
* read some Tag and Length in order to define the next transition, and if this transition
* do a grammar switch.
- * @param tlv The TLV to rollback
+ * @param tlv The TLV to roll-back
*/
void rewind();
/**
- * Look for the closest parent which has an expected length above 0
+ * Update the parent's length
*/
void updateParent();
Modified: directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java?rev=1235689&r1=1235688&r2=1235689&view=diff
==============================================================================
--- directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java (original)
+++ directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java Wed Jan 25 08:48:29 2012
@@ -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.asn1.ber;
@@ -79,9 +79,9 @@ public class Asn1Decoder implements TLVB
* Treat the start of a TLV. It reads the tag and get its value.
*
* @param stream The ByteBuffer containing the PDU to decode
- * @param container The container that stores the current state,
+ * @param container The container that stores the current state,
* the result and other informations.
- * @return <code>true</code> if there are more bytes to read, <code>false
+ * @return <code>true</code> if there are more bytes to read, <code>false
* </code> otherwise
*/
private boolean treatTagStartState( ByteBuffer stream, Asn1Container container )
@@ -186,9 +186,9 @@ public class Asn1Decoder implements TLVB
* the LENGTH, which can be multi-bytes.
*
* @param stream The ByteBuffer containing the PDU to decode
- * @param container The container that stores the current state,
+ * @param container The container that stores the current state,
* the result and other informations.
- * @return <code>true</code> if there are more bytes to read, <code>false
+ * @return <code>true</code> if there are more bytes to read, <code>false
* </code> otherwise
* @throws DecoderException Thrown if anything went wrong
*/
@@ -245,9 +245,9 @@ public class Asn1Decoder implements TLVB
* but the lack of bytes in the buffer stopped the process.
*
* @param stream The ByteBuffer containing the PDU to decode
- * @param container The container that stores the current state,
+ * @param container The container that stores the current state,
* the result and other informations.
- * @return <code>true</code> if there are more bytes to read, <code>false
+ * @return <code>true</code> if there are more bytes to read, <code>false
* </code> otherwise
*/
private boolean treatLengthPendingState( ByteBuffer stream, Asn1Container container )
@@ -333,7 +333,7 @@ public class Asn1Decoder implements TLVB
/**
* The Length is fully decoded. We have to call an action to check the size.
*
- * @param container The container that stores the current state,
+ * @param container The container that stores the current state,
* the result and other informations.
* @throws DecoderException Thrown if anything went wrong
*/
@@ -499,9 +499,9 @@ public class Asn1Decoder implements TLVB
* nothing will be done.
*
* @param stream The ByteBuffer containing the PDU to decode
- * @param container The container that stores the current state,
+ * @param container The container that stores the current state,
* the result and other informations.
- * @return <code>true</code> if there are more bytes to read, <code>false
+ * @return <code>true</code> if there are more bytes to read, <code>false
* </code> otherwise
*/
private boolean treatValueStartState( ByteBuffer stream, Asn1Container container )
@@ -543,10 +543,10 @@ public class Asn1Decoder implements TLVB
* Treat a pending Value when we get more bytes in the buffer.
*
* @param stream The ByteBuffer containing the PDU to decode
- * @param container The container that stores the current state,
+ * @param container The container that stores the current state,
* the result and other informations.
* @return <code>MORE</code> if some bytes remain in the buffer when the
- * value has been decoded, <code>END</code> if whe still need to get some
+ * value has been decoded, <code>END</code> if whe still need to get some
* more bytes.
*/
private boolean treatValuePendingState( ByteBuffer stream, Asn1Container container )
@@ -582,9 +582,9 @@ public class Asn1Decoder implements TLVB
* action and switch to the next TLV, which will start with a Tag.
*
* @param stream The ByteBuffer containing the PDU to decode
- * @param container The container that stores the current state,
+ * @param container The container that stores the current state,
* the result and other informations.
- * @return <code>true</code> if there are more bytes to read, <code>false
+ * @return <code>true</code> if there are more bytes to read, <code>false
* </code> otherwise
* @throws DecoderException Thrown if anything went wrong
*/
@@ -637,7 +637,7 @@ public class Asn1Decoder implements TLVB
* or if the PDU has been fully decoded.
*
* @param stream The ByteBuffer containing the PDU to decode
- * @param container The container that store the state, the result
+ * @param container The container that store the state, the result
* and other elements.
* @throws DecoderException Thrown if anything went wrong!
*/
@@ -645,9 +645,9 @@ public class Asn1Decoder implements TLVB
{
/*
* We have to deal with the current state. This is an infinite loop,
- * which will stop for any of these reasons :
- * - STATE_END has been reached (hopefully, the most frequent case)
- * - buffer is empty (it could happen)
+ * which will stop for any of these reasons :
+ * - STATE_END has been reached (hopefully, the most frequent case)
+ * - buffer is empty (it could happen)
* - STATE_OVERFLOW : bad situation ! The PDU may be a
* malevolous hand crafted ones, that try to "kill" our decoder. We
* must log it with all information to track back this case, and punish
@@ -783,9 +783,7 @@ public class Asn1Decoder implements TLVB
/**
- * Get the length's Length.
- *
- * @return Returns the length's Length.
+ * {@inheritDoc}
*/
public int getMaxLengthLength()
{
@@ -794,9 +792,7 @@ public class Asn1Decoder implements TLVB
/**
- * Get the maximum Tag's length
- *
- * @return Returns the maximum tag Length.
+ * {@inheritDoc}
*/
public int getMaxTagLength()
{
@@ -805,7 +801,7 @@ public class Asn1Decoder implements TLVB
/**
- * Disallow indefinite length.
+ * {@inheritDoc}
*/
public void disallowIndefiniteLength()
{
@@ -814,7 +810,7 @@ public class Asn1Decoder implements TLVB
/**
- * Allow indefinite length.
+ * {@inheritDoc}
*/
public void allowIndefiniteLength()
{
@@ -823,10 +819,7 @@ public class Asn1Decoder implements TLVB
/**
- * Tells if indefinite length form could be used for Length
- *
- * @return Returns <code>true</code> if the current decoder support
- * indefinite length
+ * {@inheritDoc}
*/
public boolean isIndefiniteLengthAllowed()
{
@@ -850,9 +843,7 @@ public class Asn1Decoder implements TLVB
/**
- * Set the maximum Tag length
- *
- * @param maxTagLength The tagLength to set.
+ * {@inheritDoc}
*/
public void setMaxTagLength( int maxTagLength )
{
Modified: directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java?rev=1235689&r1=1235688&r2=1235689&view=diff
==============================================================================
--- directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java (original)
+++ directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/AbstractGrammar.java Wed Jan 25 08:48:29 2012
@@ -32,9 +32,11 @@ import org.slf4j.LoggerFactory;
* The abstract Grammar which is the Mother of all the grammars. It contains
* the transitions table.
*
+ * @param C The container type
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public abstract class AbstractGrammar<E extends Asn1Container> implements Grammar<E>
+public abstract class AbstractGrammar<C extends Asn1Container> implements Grammar<C>
{
/** The logger */
private static final Logger LOG = LoggerFactory.getLogger( AbstractGrammar.class );
@@ -44,10 +46,10 @@ public abstract class AbstractGrammar<E
/**
* Table of transitions. It's a two dimension array, the first dimension
- * indice the states, the second dimension indices the Tag value, so it is
+ * indices the states, the second dimension indices the Tag value, so it is
* 256 wide.
*/
- protected GrammarTransition<E>[][] transitions;
+ protected GrammarTransition<C>[][] transitions;
/** The grammar name */
private String name;
@@ -60,9 +62,7 @@ public abstract class AbstractGrammar<E
/**
- * Return the grammar's name
- *
- * @return The grammar name
+ * {@inheritDoc}
*/
public String getName()
{
@@ -71,9 +71,7 @@ public abstract class AbstractGrammar<E
/**
- * Set the grammar's name
- *
- * @param name The new grammar name
+ * {@inheritDoc}
*/
public void setName( String name )
{
@@ -88,20 +86,16 @@ public abstract class AbstractGrammar<E
* @param tag The current tag
* @return A valid transition if any, or null.
*/
- public GrammarTransition<E> getTransition( Enum<?> state, int tag )
+ public GrammarTransition<C> getTransition( Enum<?> state, int tag )
{
return transitions[state.ordinal()][tag & 0x00FF];
}
/**
- * The main function. This is where an action is executed. If the action is
- * null, nothing is done.
- *
- * @param container The Asn1Container
- * @throws DecoderException Thrown if anything went wrong
+ * {@inheritDoc}
*/
- public void executeAction( E container ) throws DecoderException
+ public void executeAction( C container ) throws DecoderException
{
Enum<?> currentState = container.getTransition();
@@ -114,7 +108,8 @@ public abstract class AbstractGrammar<E
byte tagByte = container.getCurrentTLV().getTag();
// We will loop until no more actions are to be executed
- GrammarTransition<E> transition = ( ( AbstractGrammar<E> ) container.getGrammar() ).getTransition(
+ @SuppressWarnings("unchecked")
+ GrammarTransition<C> transition = ( ( AbstractGrammar<C> ) container.getGrammar() ).getTransition(
currentState,
tagByte );
@@ -137,7 +132,7 @@ public abstract class AbstractGrammar<E
if ( transition.hasAction() )
{
- Action<E> action = transition.getAction();
+ Action<C> action = transition.getAction();
action.action( container );
}
Modified: directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/Action.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/Action.java?rev=1235689&r1=1235688&r2=1235689&view=diff
==============================================================================
--- directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/Action.java (original)
+++ directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/Action.java Wed Jan 25 08:48:29 2012
@@ -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.asn1.ber.grammar;
@@ -28,9 +28,11 @@ import org.apache.directory.shared.asn1.
* Action interface just contains the method 'action' which must be implemented
* in all the implementing classes.
*
+ * @param C The container type
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public interface Action<E extends Asn1Container>
+public interface Action<C extends Asn1Container>
{
/**
* The action to be executed.
@@ -38,5 +40,5 @@ public interface Action<E extends Asn1Co
* @param container The container which stores the current data
* @throws DecoderException Thrown if something went wrong.
*/
- void action( E container ) throws DecoderException;
+ void action( C container ) throws DecoderException;
}
Modified: directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/Grammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/Grammar.java?rev=1235689&r1=1235688&r2=1235689&view=diff
==============================================================================
--- directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/Grammar.java (original)
+++ directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/Grammar.java Wed Jan 25 08:48:29 2012
@@ -27,9 +27,11 @@ import org.apache.directory.shared.asn1.
/**
* The interface which expose common behavior of a Grammar implementer.
*
+ * @param C The container type
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public interface Grammar<E extends Asn1Container>
+public interface Grammar<C extends Asn1Container>
{
/**
* This method, when called, execute an action on the current data stored in
@@ -38,7 +40,7 @@ public interface Grammar<E extends Asn1C
* @param asn1Container Store the data being processed.
* @throws DecoderException Thrown when an unrecoverable error occurs.
*/
- void executeAction( E asn1Container ) throws DecoderException;
+ void executeAction( C asn1Container ) throws DecoderException;
/**
Modified: directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/GrammarAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/GrammarAction.java?rev=1235689&r1=1235688&r2=1235689&view=diff
==============================================================================
--- directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/GrammarAction.java (original)
+++ directory/shared/trunk/asn1/ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/GrammarAction.java Wed Jan 25 08:48:29 2012
@@ -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.asn1.ber.grammar;
@@ -27,9 +27,11 @@ import org.apache.directory.shared.asn1.
* A top level grammar class that store meta informations about the actions.
* Those informations are not mandatory, but they can be useful for debugging.
*
+ * @param C The container type
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public abstract class GrammarAction<E extends Asn1Container> implements Action<E>
+public abstract class GrammarAction<C extends Asn1Container> implements Action<C>
{
/** The action's name */
protected String name;
@@ -44,7 +46,7 @@ public abstract class GrammarAction<E ex
/**
* Creates a new GrammarAction object.
*
- * @param name The name of the create action
+ * @param name The name of the grammar action
*/
public GrammarAction( String name )
{
@@ -53,7 +55,7 @@ public abstract class GrammarAction<E ex
/**
- * Print the action's name
+ * Prints the action's name
*
* @return The action's name
*/