com.voytechs.jnetstream.protocol
Class NPLProtocolBinding

java.lang.Object
  extended by com.voytechs.jnetstream.protocol.NPLProtocolBinding
All Implemented Interfaces:
ProtocolBinding

public class NPLProtocolBinding
extends java.lang.Object
implements ProtocolBinding

Implementation for protocol binding using the legacy NPL AST. This is not part of public API.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.slytechs.jnetstream.protocol.ProtocolBinding
ProtocolBinding.BindingBuilder
 
Constructor Summary
NPLProtocolBinding(java.lang.String source, java.lang.String expression, LinkStatement link)
           
 
Method Summary
 LinkStatement getCode()
           
 java.util.List getDependancies()
          Returns the list of protocol dependencies.
 java.lang.String getExpression()
          Returns the original NPL expression as a String.
 java.lang.String getSinkName()
          Get the sink protocol.
 java.lang.String getSourceName()
          Get the source protocol.
 boolean isLinked()
          Checks if this binding has been linked into the runtime environment for the sink packet.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NPLProtocolBinding

public NPLProtocolBinding(java.lang.String source,
                          java.lang.String expression,
                          LinkStatement link)
Parameters:
source -
link -
Method Detail

getSourceName

public java.lang.String getSourceName()
Description copied from interface: ProtocolBinding
Get the source protocol. The protocol for which this binding was defined.

Specified by:
getSourceName in interface ProtocolBinding
Returns:
name of the source protocol.

getSinkName

public java.lang.String getSinkName()
Description copied from interface: ProtocolBinding
Get the sink protocol. The protocol which will evaluate this binding's expression to determine if the source protocol is applicable.

Specified by:
getSinkName in interface ProtocolBinding
Returns:
name of the sink protocol

getExpression

public java.lang.String getExpression()
Description copied from interface: ProtocolBinding
Returns the original NPL expression as a String. This expression is compiled and linked into the runtime environment for the sink protocol.

Specified by:
getExpression in interface ProtocolBinding
Returns:
String expression that will be evaluated.

getDependancies

public java.util.List getDependancies()
Description copied from interface: ProtocolBinding
Returns the list of protocol dependencies. That is the list of all the protocols referenced by this binding's expression. The sink protocol is always 1 dependency, but there could be others. This is the list that is used during evaluation to load any additional protocols that the expression will depend on. Care must be taken when using other dependencies in the Binding expressions, to ensure that the other referenced protocols really do exist in the packet beind dissected, otherwise a runtime exception may be thrown.

Specified by:
getDependancies in interface ProtocolBinding
Returns:
List of names of protocols which binding depends on. Will always have atleast 1, the sink protocol name.

getCode

public LinkStatement getCode()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

isLinked

public boolean isLinked()
Description copied from interface: ProtocolBinding
Checks if this binding has been linked into the runtime environment for the sink packet. If the sink packet has not been loaded and linked, this binding will also not be linked. Linking of bindings happens when the protocol is loaded, not before.

Specified by:
isLinked in interface ProtocolBinding
Returns:
Returns the linked.