Prism.core
Class Connector

java.lang.Object
  extended by Prism.core.Brick
      extended by Prism.core.Connector
All Implemented Interfaces:
java.io.Serializable, IBrick, IConnector
Direct Known Subclasses:
ExtensibleConnector

public class Connector
extends Brick
implements IConnector

A connector provides interaction and mediation services to attached components. The connector is connected to a set of components on both sides (a set may be empty). Connectors use the provided AbstractHandler to distribute event among connected Bricks.

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

Field Summary
 
Fields inherited from interface Prism.core.IConnector
INITIAL_SIZE_OF_BRICK_QUEUE
 
Constructor Summary
Connector()
          This constructor creates an connector with default parameters.
Connector(AbstractScaffold scaffold)
          This constructor sets the scaffold of this connector to scaffold.
Connector(int style)
          This constructor sets the style of this connector to style.
Connector(java.lang.String name)
          This constructor sets the name of this connector to name.
Connector(java.lang.String name, int style, AbstractScaffold scaffold)
          Initializes the name, style, and scaffold of this connector.
 
Method Summary
 void addPort(IPort port)
          Adds a port to this connector.
 java.util.Vector<IPort> getPorts()
          This method returns a list of all available ports.
 void handle(Event e)
          This method distributes the incoming event to connected Bricks.
 void removePort(IPort port)
          Removes a port from this connector.
 void start()
          By default a brick does not do anything.
 
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

Connector

public Connector()
This constructor creates an connector with default parameters.


Connector

public Connector(java.lang.String name)
This constructor sets the name of this connector to name.

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

Connector

public Connector(int style)
This constructor sets the style of this connector to style.

Parameters:
style - The style of this connector.

Connector

public Connector(AbstractScaffold scaffold)
This constructor sets the scaffold of this connector to scaffold.

Parameters:
scaffold - The scaffold of this connector.

Connector

public Connector(java.lang.String name,
                 int style,
                 AbstractScaffold scaffold)
Initializes the name, style, and scaffold of this connector.

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

handle

public void handle(Event e)
This method distributes the incoming event to connected Bricks. Distribution policy depends on the type of IHandler that is installed.

Specified by:
handle in interface IBrick
Specified by:
handle in interface IConnector
Specified by:
handle in class Brick
Parameters:
e - Incoming Event

addPort

public void addPort(IPort port)
Adds a port to this connector.

Specified by:
addPort in interface IConnector
Parameters:
port - Port to be added.

removePort

public void removePort(IPort port)
Removes a port from this connector.

Specified by:
removePort in interface IConnector
Parameters:
port - Port to be removed.

getPorts

public java.util.Vector<IPort> getPorts()
Description copied from interface: IConnector
This method returns a list of all available ports.

Specified by:
getPorts in interface IConnector
Returns:
Vector List of available ports

start

public void start()
Description copied from interface: IBrick
By default a brick does not do anything. The start method is called to activate this brick

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