org.apache.directory.shared.asn1.ber
Class AbstractContainer

java.lang.Object
  extended by org.apache.directory.shared.asn1.ber.AbstractContainer
All Implemented Interfaces:
IAsn1Container

public class AbstractContainer
extends java.lang.Object
implements IAsn1Container

This class is the abstract container used to store the current state of a PDU being decoded. It also stores the grammars used to decode the PDU, and zll the informations needed to decode a PDU.

Author:
Apache Directory Project

Field Summary
protected  IGrammar grammar
          All the possible grammars
protected  boolean grammarEndAllowed
          The grammar end transition flag
protected  TLV parentTLV
          The parent TLV
protected  int state
          The current state of the decoding
protected  IStates states
          Store the different states for debug purpose
protected  int[] stateStack
          Store a stack of the current states used when switching grammars
protected  TLV tlv
          The current TLV
protected  int transition
          The current transition
 
Constructor Summary
AbstractContainer()
           
 
Method Summary
 void clean()
          Clean the container for the next usage.
 TLV getCurrentTLV()
          Get the current TLV
 IGrammar getGrammar()
          Get the current grammar
 int getNewTlvId()
          Get a new TLV id
 TLV getParentTLV()
          Get the parent TLV;
 int getState()
          Get the current grammar state
 IStates getStates()
          Get the states for this container's grammars
 int getTlvId()
          Get the current TLV id
 int getTransition()
          Get the transition
 void grammarEndAllowed(boolean grammarEndAllowed)
          Set the flag to allow a end transition
 boolean isGrammarEndAllowed()
          Check that we can have a end state after this transition
 void setCurrentTLV(TLV tlv)
          Set the current TLV
 void setParentTLV(TLV parentTLV)
          Set the parent TLV.
 void setState(int state)
          Set the new current state
 void setTransition(int transition)
          Update the transition from a state to another
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

grammar

protected IGrammar grammar
All the possible grammars


stateStack

protected int[] stateStack
Store a stack of the current states used when switching grammars


state

protected int state
The current state of the decoding


transition

protected int transition
The current transition


tlv

protected TLV tlv
The current TLV


states

protected IStates states
Store the different states for debug purpose


parentTLV

protected TLV parentTLV
The parent TLV


grammarEndAllowed

protected boolean grammarEndAllowed
The grammar end transition flag

Constructor Detail

AbstractContainer

public AbstractContainer()
Method Detail

getGrammar

public IGrammar getGrammar()
Get the current grammar

Specified by:
getGrammar in interface IAsn1Container
Returns:
Returns the grammar used to decode a LdapMessage.

getState

public int getState()
Get the current grammar state

Specified by:
getState in interface IAsn1Container
Returns:
Returns the current grammar state

setState

public void setState(int state)
Set the new current state

Specified by:
setState in interface IAsn1Container
Parameters:
state - The new state

isGrammarEndAllowed

public boolean isGrammarEndAllowed()
Check that we can have a end state after this transition

Specified by:
isGrammarEndAllowed in interface IAsn1Container
Returns:
true if this can be the last transition

grammarEndAllowed

public void grammarEndAllowed(boolean grammarEndAllowed)
Set the flag to allow a end transition

Specified by:
grammarEndAllowed in interface IAsn1Container
Parameters:
endAllowed - true or false, depending on the next transition being an end or not.

getTransition

public int getTransition()
Get the transition

Specified by:
getTransition in interface IAsn1Container
Returns:
Returns the transition from the previous state to the new state

setTransition

public void setTransition(int transition)
Update the transition from a state to another

Specified by:
setTransition in interface IAsn1Container
Parameters:
transition - The transition to set

setCurrentTLV

public void setCurrentTLV(TLV tlv)
Set the current TLV

Specified by:
setCurrentTLV in interface IAsn1Container
Parameters:
tlv - The current TLV

getCurrentTLV

public TLV getCurrentTLV()
Get the current TLV

Specified by:
getCurrentTLV in interface IAsn1Container
Returns:
Returns the current TLV being decoded

getStates

public IStates getStates()
Get the states for this container's grammars

Specified by:
getStates in interface IAsn1Container
Returns:
Returns the states.

getParentTLV

public TLV getParentTLV()
Get the parent TLV;

Specified by:
getParentTLV in interface IAsn1Container
Returns:
Returns the parent TLV, if any.

setParentTLV

public void setParentTLV(TLV parentTLV)
Set the parent TLV.

Specified by:
setParentTLV in interface IAsn1Container
Parameters:
The - parent TLV to set.

clean

public void clean()
Clean the container for the next usage.


getNewTlvId

public int getNewTlvId()
Description copied from interface: IAsn1Container
Get a new TLV id

Specified by:
getNewTlvId in interface IAsn1Container
Returns:
a unique value representing the current TLV id

getTlvId

public int getTlvId()
Description copied from interface: IAsn1Container
Get the current TLV id

Specified by:
getTlvId in interface IAsn1Container
Returns:
a unique value representing the current TLV id


Copyright © 2004-2009. All Rights Reserved.