at.jku.fim.datalinksimulation.genericdevices
Class NetworkStation

java.lang.Object
  extended by at.jku.fim.datalinksimulation.genericdevices.NetworkStation
All Implemented Interfaces:
WireConnector

public class NetworkStation
extends java.lang.Object
implements WireConnector

Title: OSI Simulation Framework

A NetworkStation represents a system, which can run different applications. Each of these have access to a single network stack for performing communication.

Copyright: (c) 2004-05

Company: FIM@JKU, www.fim.uni-linz.ac.at

Version:
$Id: NetworkStation.java,v 1.1 2005/10/27 13:10:07 aputzinger Exp $
Author:
Andreas Putzinger

Field Summary
protected  Logger logger
           
protected  NetworkStack networkStack
          Internal network stack reference
protected  int PID
          A PID counter so that a PID is unique.
protected  java.util.HashMap PIDApplicationMapping
          Running application get a Process ID (pid).
 
Constructor Summary
NetworkStation(java.lang.Object stationID)
          Constructor; Each network station in a system should have a unique ID
 
Method Summary
 void bePlugged(Wire wire, int portNr)
          This method should only be called by Wires, which inform this WireConnector that they are connected.
 void beUnplugged(Wire wire, int portNr)
          This method should only be called by Wires, which inform this WireConnector that they are disconnected
 NetworkStack getNetworkStack()
           
 int getNumberOfTotalPorts()
           
 java.lang.Object getStationID()
           
 void informAboutDataOnWire(Wire sender, RawData data)
          informAboutWireData
 void removeApplication(int applicationPID)
           
 int runApplication(Application applicationObj)
          Starts an application on this network station
 void setStationID(java.lang.Object stationID)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

networkStack

protected NetworkStack networkStack
Internal network stack reference


PIDApplicationMapping

protected java.util.HashMap PIDApplicationMapping
Running application get a Process ID (pid). The mapping between the actual application and the PID is stored in this HashMap


PID

protected int PID
A PID counter so that a PID is unique.


logger

protected Logger logger
Constructor Detail

NetworkStation

public NetworkStation(java.lang.Object stationID)
Constructor; Each network station in a system should have a unique ID

Parameters:
stationID - Unique station ID
Method Detail

getStationID

public java.lang.Object getStationID()
Returns:
Returns the stationID.

setStationID

public void setStationID(java.lang.Object stationID)
Parameters:
stationID - The stationID to set.

runApplication

public int runApplication(Application applicationObj)
Starts an application on this network station

Parameters:
applicationObj -
Returns:
Process ID

removeApplication

public void removeApplication(int applicationPID)
Parameters:
applicationPID -

informAboutDataOnWire

public void informAboutDataOnWire(Wire sender,
                                  RawData data)
informAboutWireData

Specified by:
informAboutDataOnWire in interface WireConnector
Parameters:
sender - Wire
data - RawData

getNetworkStack

public NetworkStack getNetworkStack()

bePlugged

public void bePlugged(Wire wire,
                      int portNr)
               throws WiringException
Description copied from interface: WireConnector
This method should only be called by Wires, which inform this WireConnector that they are connected.

Specified by:
bePlugged in interface WireConnector
Parameters:
wire - Connected wire
Throws:
WiringException - May be thrown to veto against this wiring

beUnplugged

public void beUnplugged(Wire wire,
                        int portNr)
                 throws WiringException
Description copied from interface: WireConnector
This method should only be called by Wires, which inform this WireConnector that they are disconnected

Specified by:
beUnplugged in interface WireConnector
Parameters:
wire - Disconnected wire
Throws:
WiringException - May be thrown on any error or veto

getNumberOfTotalPorts

public int getNumberOfTotalPorts()