Prism.extensions.port.distribution
Class AbstractDistribution

java.lang.Object
  extended by Prism.extensions.port.distribution.AbstractDistribution
Direct Known Subclasses:
IRDistribution, SocketDistribution

public abstract class AbstractDistribution
extends java.lang.Object

Any distribution implementation in Prism needs to extend this abstract class. The communication protocol doesn't matter as long as the appropriate implementation is provided for the methods specified in this abstract class.

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

Constructor Summary
AbstractDistribution()
           
 
Method Summary
abstract  void addConnection(AbstractConnection pConn)
          Adds the connection to the list of connections.
abstract  AbstractConnection connect(java.lang.String hostName, int portNum)
          Creates a connection between this ExtensiblePort to the desired ExtensiblePort.
abstract  java.util.Vector<AbstractConnection> getConnections()
          Returns list of connections that are affiliated with the parent port
abstract  int getListeningPortNum()
          Returns the port number used to listen for incoming connection requests.
abstract  ExtensiblePort getParentPort()
          Returns the parent ExtensiblePort, which is the ExtensiblePort that is associated with this distribution object.
abstract  void readEvent(java.lang.Object eventObj)
          Gets the incoming event from the connection.
abstract  void removeConnection(AbstractConnection pConn)
          Removes the connection from the list of connections.
abstract  void setParentPort(ExtensiblePort port)
          Set the parent ExtensiblePort, which is the ExtensiblePort that is associated with this distribution object.
abstract  void start()
          This method is called from the ExtensiblePort to initialized the distribution.
abstract  void writeEvent(java.lang.Object eventObj)
          Sends the outgoing event to the connections.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDistribution

public AbstractDistribution()
Method Detail

setParentPort

public abstract void setParentPort(ExtensiblePort port)
Set the parent ExtensiblePort, which is the ExtensiblePort that is associated with this distribution object.

Parameters:
parent - ExtensiblePort

getParentPort

public abstract ExtensiblePort getParentPort()
Returns the parent ExtensiblePort, which is the ExtensiblePort that is associated with this distribution object.

Returns:
Parent ExtensiblePort

getListeningPortNum

public abstract int getListeningPortNum()
Returns the port number used to listen for incoming connection requests.

Returns:
port number

getConnections

public abstract java.util.Vector<AbstractConnection> getConnections()
Returns list of connections that are affiliated with the parent port

Returns:
list of connections

start

public abstract void start()
This method is called from the ExtensiblePort to initialized the distribution.


connect

public abstract AbstractConnection connect(java.lang.String hostName,
                                           int portNum)
Creates a connection between this ExtensiblePort to the desired ExtensiblePort.

Parameters:
hostName - Name of the host to which this connector is connecting. It is in the form of IP address or hostname.
portNum - Port to which this connection will be binded.

writeEvent

public abstract void writeEvent(java.lang.Object eventObj)
Sends the outgoing event to the connections.

Parameters:
eventObj - Outgoing event

readEvent

public abstract void readEvent(java.lang.Object eventObj)
Gets the incoming event from the connection.

Parameters:
eventObj - Incoming event

addConnection

public abstract void addConnection(AbstractConnection pConn)
Adds the connection to the list of connections.

Parameters:
pConn - Connection to be added

removeConnection

public abstract void removeConnection(AbstractConnection pConn)
Removes the connection from the list of connections.

Parameters:
pConn - Connection to be removed