com.voytechs.jnetstream.protocol
Class LegacyProtocol

java.lang.Object
  extended by com.voytechs.jnetstream.protocol.LegacyProtocol
All Implemented Interfaces:
Protocol

public class LegacyProtocol
extends java.lang.Object
implements Protocol

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Constructor Summary
LegacyProtocol(java.lang.String name, java.net.URL url, ProtocolLoader loader)
           
 
Method Summary
 java.util.Set getAvailableProtocolImplementationTypes()
          Returns a set of available types (ProtocolType) for this specific protocol.
 StatementContainer getCode()
           
 java.lang.String getName()
          Returns the name of this protocol.
 ProtocolImplementationType getProtocolImplementationType()
          Returns the current implementation type of this specific protocol.
 ProtocolLoader getProtocolLoader()
           
 java.util.List getSinkBindings()
          Returns a list of Bindings that are bound to this protocol.
 java.util.List getSourceBindings()
          Returns a list of Bindings that are defined for this protocol.
 java.net.URL getURL()
          Get the URL which points to the defininition of this protocol.
 boolean hasCode()
           
 boolean isLinked()
           
 boolean isLoaded()
          Checks if the current protocol has been loaded.
 void load()
          Loads the protocol into memory from source definition.
 void setCode(StatementContainer stat)
           
 void setLinked(boolean linked)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LegacyProtocol

public LegacyProtocol(java.lang.String name,
                      java.net.URL url,
                      ProtocolLoader loader)
Parameters:
name -
Method Detail

getName

public java.lang.String getName()
Description copied from interface: Protocol
Returns the name of this protocol. Protocol names are unique.

Specified by:
getName in interface Protocol
Returns:
name of this protocol

getSourceBindings

public java.util.List getSourceBindings()
Description copied from interface: Protocol
Returns a list of Bindings that are defined for this protocol. The bindings links between a sourc and a sink protocol. This is the list of the bindings at the source.

Specified by:
getSourceBindings in interface Protocol
Returns:
list of source bindings

getSinkBindings

public java.util.List getSinkBindings()
Description copied from interface: Protocol
Returns a list of Bindings that are bound to this protocol. The Sink protocol evaluates the binding expression to determine if the source protocol (the one binding to it) is a candidate for parsing the next portion of the packet.

Specified by:
getSinkBindings in interface Protocol
Returns:
list of sink bindings

hasCode

public boolean hasCode()

setCode

public void setCode(StatementContainer stat)
Parameters:
stat -

getCode

public StatementContainer getCode()
Returns:
Returns the code.

isLoaded

public boolean isLoaded()
Description copied from interface: Protocol
Checks if the current protocol has been loaded. The protocol doesn't have to be loaded, which means this is just a stub protocol.

Specified by:
isLoaded in interface Protocol
Returns:
true if protocol has been loaded, otherwise false.

getURL

public java.net.URL getURL()
Description copied from interface: Protocol
Get the URL which points to the defininition of this protocol. This may be a local file or remote HTTP url.

Specified by:
getURL in interface Protocol
Returns:
the url of the source code for this protocol

getProtocolLoader

public ProtocolLoader getProtocolLoader()
Returns:
Returns the protocolLoader.

isLinked

public boolean isLinked()
Returns:

setLinked

public void setLinked(boolean linked)
Parameters:
linked - The linked to set.

load

public void load()
          throws ProtocolDeclarationException,
                 ProtocolNotFoundException,
                 java.io.IOException
Description copied from interface: Protocol
Loads the protocol into memory from source definition. This is typically done on demand, only when needed, but the user can load a protocol at any time. This method can also be used to check for syntax errors as this will cause the source file to be compiled. Although the protocol will be loaded, it will not be linked into the environment. Linking only happens when all of the protocol dependencies have been fulfilled and right before the protocol is to be used for the first time.

Specified by:
load in interface Protocol
Throws:
ProtocolDeclarationException - declaration or syntax errors. Declaration error is the one that does not technically generate a NPL syntax error in the source, but declares an invalid object that can not be used as a protocol. Only Headers and Family object can be used as protocol declarations.
ProtocolNotFoundException - protocol definition was not found at the specified url
java.io.IOException - any protocols while trying to physically access the protocol definition

getProtocolImplementationType

public ProtocolImplementationType getProtocolImplementationType()
Description copied from interface: Protocol
Returns the current implementation type of this specific protocol. This is dependent on the discovery of the protocol and implementation types available. The runtime system will choose the most efficient type of protocol implementation to utilize, based on the available set.

Specified by:
getProtocolImplementationType in interface Protocol
Returns:
type of this specific protocol

getAvailableProtocolImplementationTypes

public java.util.Set getAvailableProtocolImplementationTypes()
Description copied from interface: Protocol
Returns a set of available types (ProtocolType) for this specific protocol. Each protocol may have different implementation types available and this method will return all available as a set.

Specified by:
getAvailableProtocolImplementationTypes in interface Protocol
Returns:
Set containing the ProtocolType enum constants as values.