Prism.extensions.port
Class ExtensiblePort

java.lang.Object
  extended by Prism.core.Brick
      extended by Prism.core.Port
          extended by Prism.extensions.port.ExtensiblePort
All Implemented Interfaces:
java.io.Serializable, IBrick, IPort

public class ExtensiblePort
extends Port

A subclass of Port provides extra functionality on top of Port object. Extra capability can be selected by installing the appropriate extension. Installation of appropriate extension can be done by done by setting the appropriate interface to the implementation of extensions. There are access methods provided to allow installation of these extensions.

Version:
2.0
Author:
USC Soft. Arch. Group. Contact: Sam Malek malek@usc.edu
See Also:
Serialized Form

Constructor Summary
ExtensiblePort(AbstractScaffold scaffold, int portType)
          This constructor sets the scaffold of this port to scaffold.
ExtensiblePort(int portType)
          This constructor creates an port with default parameters.
ExtensiblePort(int style, int portType)
          This constructor sets the style of this port to style.
ExtensiblePort(java.lang.String name, int portType)
          This constructor sets the name of this port to name.
ExtensiblePort(java.lang.String name, int style, AbstractScaffold scaffold, int portType)
          Initializes the name, style, and scaffold of this port.
 
Method Summary
 void addCompression(AbstractCompression compression)
          Installs the compression extension.
 void addDistribution(AbstractDistribution distribution)
          Installs the distribution extension.
 void connect(java.lang.String hostName, int portNum)
          Method for connecting to a remote host.
 AbstractCompression getCompressionModule()
          Returns the installed Compression extension.
 void handle(Event e)
          The default handler, determines the type of processing needed to be done.
 void handle(java.lang.Object eventObject, java.lang.String direction)
          Checks the type of extensions installed.
 void start()
          Calls the start method of all the implemented interfaces in the appropriate order.
 
Methods inherited from class Prism.core.Port
getExtensiblePort, getMutualPort, getParentBrick, getPortType, setExtensiblePort, setMutualPort, setParentBrick
 
Methods inherited from class Prism.core.Brick
add, getName, getScaffold, getStyle, setName, setScaffold
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface Prism.core.IBrick
add, getName, getScaffold, getStyle, setName, setScaffold
 

Constructor Detail

ExtensiblePort

public ExtensiblePort(int portType)
This constructor creates an port with default parameters.


ExtensiblePort

public ExtensiblePort(java.lang.String name,
                      int portType)
This constructor sets the name of this port to name.

Parameters:
name - The name of this port. It cannot be a null value.

ExtensiblePort

public ExtensiblePort(int style,
                      int portType)
This constructor sets the style of this port to style.

Parameters:
style - The style of this port.

ExtensiblePort

public ExtensiblePort(AbstractScaffold scaffold,
                      int portType)
This constructor sets the scaffold of this port to scaffold.

Parameters:
scaffold - The scaffold of this port.

ExtensiblePort

public ExtensiblePort(java.lang.String name,
                      int style,
                      AbstractScaffold scaffold,
                      int portType)
Initializes the name, style, and scaffold of this port.

Parameters:
name - The name of this port.
style - The style of this port.
scaffold - The scaffold of this port.
Method Detail

getCompressionModule

public AbstractCompression getCompressionModule()
Returns the installed Compression extension.

Returns:
AbstractCompression installed compression extension

start

public void start()
Calls the start method of all the implemented interfaces in the appropriate order.

Specified by:
start in interface IBrick
Overrides:
start in class Brick

handle

public void handle(Event e)
The default handler, determines the type of processing needed to be done. There are two types of processing. Processing event that is incoming and processing event that is outgoing.

Specified by:
handle in interface IBrick
Overrides:
handle in class Port
Parameters:
e - event

handle

public void handle(java.lang.Object eventObject,
                   java.lang.String direction)
Checks the type of extensions installed. Depending on the extensions installed the appropriate processing is done.

Parameters:
eventObject - represents the event
direction - incoming vs outgoing

addDistribution

public void addDistribution(AbstractDistribution distribution)
Installs the distribution extension.

Parameters:
dist - distribution extension.

addCompression

public void addCompression(AbstractCompression compression)
Installs the compression extension.

Parameters:
compression - compression extension.

connect

public void connect(java.lang.String hostName,
                    int portNum)
Method for connecting to a remote host. Also initiates security key exchange if security extension is installed.

Parameters:
hostName - host name or IP address of destination
portNum - port num of destination