Prism.core
Class Component

java.lang.Object
  extended by Prism.core.Brick
      extended by Prism.core.Component
All Implemented Interfaces:
java.io.Serializable, IBrick, IComponent
Direct Known Subclasses:
ExtensibleComponent, HelloWorldClient, HelloWorldServer

public class Component
extends Brick
implements IComponent, java.io.Serializable

This class defines the basic Prism component and the send methods that allow any class extending this one to interact with the architecture. The usual practice is to create a component in your own architecture by extending this class and implementing the handle method.

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.IComponent
CONNS_PER_COMPONENT
 
Constructor Summary
Component()
          This constructor creates an component with default parameters.
Component(AbstractScaffold scaffold)
          This constructor sets the scaffold of this component to scaffold.
Component(int style)
          This constructor sets the style of this component to style.
Component(java.lang.String name)
          This constructor sets the name of this component to name.
Component(java.lang.String name, int style, AbstractScaffold scaffold)
          Initializes the name, style, and scaffold of this component.
 
Method Summary
 void addPort(IPort port)
          Adds a port to this component.
 AbstractImplementation getImplementation()
           
 java.util.Vector<IPort> getPorts()
          This method returns a list of all available ports.
 void handle(Event e)
          Handling of Event.
 void removePort(IPort port)
          Removes a port from this component.
 void send(Event e)
          This method sends the event up/down the Prism architecture that this component is a part of.
 void setImplementation(AbstractImplementation impl)
           
 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

Component

public Component()
This constructor creates an component with default parameters.


Component

public Component(java.lang.String name)
This constructor sets the name of this component to name.

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

Component

public Component(int style)
This constructor sets the style of this component to style.

Parameters:
style - The style of this component.

Component

public Component(AbstractScaffold scaffold)
This constructor sets the scaffold of this component to scaffold.

Parameters:
scaffold - The scaffold of this component.

Component

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

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

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

setImplementation

public void setImplementation(AbstractImplementation impl)

getImplementation

public AbstractImplementation getImplementation()

send

public void send(Event e)
This method sends the event up/down the Prism architecture that this component is a part of.

Specified by:
send in interface IComponent
Parameters:
e - a Event to be sent to the Brick above/below.

handle

public void handle(Event e)
Handling of Event. This is application specific code and should be implemented by subclasses of this class.

Specified by:
handle in interface IBrick
Specified by:
handle in interface IComponent
Specified by:
handle in class Brick
Parameters:
e - Event to be handled

addPort

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

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

removePort

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

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

getPorts

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

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