edu.colorado.cs.ns2.agents
Class Application

java.lang.Object
  extended by edu.colorado.cs.ns2.agents.Application
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CBRAgent, ExponentialAgent, FTPAgent, ParetoAgent, TelnetAgent

public abstract class Application
extends java.lang.Object
implements java.io.Serializable

Defines Abstract Class Application. This abstract class must be implemented for all new Application subtypes.

Author:
Kevin Bauer, Pushkar Sambhoos.
See Also:
Serialized Form

Field Summary
protected  java.util.Vector<java.lang.String> acceptableConnectAgents
          A Vector of Agent names that are acceptable for attaching this Application.
protected  int agentId
          Stores the agent identifier on which this application resides.
protected  int applicationId
          Stores the application identifer.
protected  java.lang.String applicationName
          Store the name of the Application in the NS2 application naming convention.
protected  int nodeId
          Stores the Node identifier on which this application's agent resides.
protected  boolean startEventScheduled
          True if a "start" event has been scheduled for this Application.
protected  boolean stopEventScheduled
          True if a "stop" event has been scheduled for this Application.
protected  java.lang.String variableName
          Stores this Application's TCL variable name
 
Constructor Summary
Application()
          Default Constructor.
 
Method Summary
abstract  java.lang.String addApplicationToScript(NsNode node, int agentElement)
          Adds the current Application to the TCL script.
 java.util.Vector<java.lang.String> getAcceptableAgents()
          Returns a Vector of the acceptable agents on which the current Application may attach.
 int getAgentId()
          Returns the unique Agent identifier.
 java.lang.String getApplicatinName()
          Returns this Application's name.
 int getApplicationId()
          Returns this Application's unique identifier.
 java.lang.String getApplicationName()
          Returns the Application's name.
 int getNodeId()
          Returns the Node's identifier on which the Application resides.
 java.lang.String getVariableName()
          Returns this Application's TCL variable name.
 boolean isStartEventScheduled()
          Returns true if this Application's "start" event has been scheduled.
 boolean isStopEventScheduled()
          Returns the status of the "stop" event in the event schedule.
protected abstract  void setAcceptableConnectAgents()
          Sets the acceptable agents on which the current Application may be attached.
 void setAgentId(int agentId)
          Sets the unique Agent identifier.
 void setApplicatioName(java.lang.String applicatioName)
          Sets this Application's name.
 void setApplicationId(int applicationId)
          Sets this Application's unique identifier.
 void setApplicationName(java.lang.String applicationName)
          Sets the application name.
 void setNodeId(int nodeId)
          Sets the node ID on which the Application resides.
abstract  void setProperties()
          Sets the current Applications properties.
 void setStartEventScheduled(boolean startEventScheduled)
          Sets the status of the "start" event in the event schedule.
 void setStopEventScheduled(boolean stopEventScheduled)
          Sets the status of the "start" event in the event schedule.
 void setVariableName(java.lang.String variableName)
          Sets this Application's TCL variable name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

applicationName

protected java.lang.String applicationName
Store the name of the Application in the NS2 application naming convention.


applicationId

protected int applicationId
Stores the application identifer.


nodeId

protected int nodeId
Stores the Node identifier on which this application's agent resides.


agentId

protected int agentId
Stores the agent identifier on which this application resides.


variableName

protected java.lang.String variableName
Stores this Application's TCL variable name


startEventScheduled

protected boolean startEventScheduled
True if a "start" event has been scheduled for this Application.


stopEventScheduled

protected boolean stopEventScheduled
True if a "stop" event has been scheduled for this Application.


acceptableConnectAgents

protected java.util.Vector<java.lang.String> acceptableConnectAgents
A Vector of Agent names that are acceptable for attaching this Application. @see Vector

Constructor Detail

Application

public Application()
Default Constructor.

Method Detail

getApplicationName

public java.lang.String getApplicationName()
Returns the Application's name.

Returns:
Returns the Application's name.

setApplicationName

public void setApplicationName(java.lang.String applicationName)
Sets the application name.

Parameters:
applicationName - - the new Application name.

getVariableName

public java.lang.String getVariableName()
Returns this Application's TCL variable name.

Returns:
This Application's TCL variable name.

setVariableName

public void setVariableName(java.lang.String variableName)
Sets this Application's TCL variable name.

Parameters:
variableName - - This Application's new TCL variable name.

getApplicatinName

public java.lang.String getApplicatinName()
Returns this Application's name.

Returns:
This Application's name.

setApplicatioName

public void setApplicatioName(java.lang.String applicatioName)
Sets this Application's name.

Parameters:
applicatioName - - This Application's new name.

getApplicationId

public int getApplicationId()
Returns this Application's unique identifier.

Returns:
This Application's unique identifier.

setApplicationId

public void setApplicationId(int applicationId)
Sets this Application's unique identifier. It is the responsibility of the caller to ensure that the identifier is, in fact, unique.

Parameters:
applicationId - - New Application identifier.

getNodeId

public int getNodeId()
Returns the Node's identifier on which the Application resides.

Returns:
The Node's identifier on which the Application resides.

setNodeId

public void setNodeId(int nodeId)
Sets the node ID on which the Application resides. It is the responsibility of the caller to ensure that the node ID value is set correctly.

Parameters:
nodeId -

getAgentId

public int getAgentId()
Returns the unique Agent identifier.

Returns:
The unique Agent identifier.

setAgentId

public void setAgentId(int agentId)
Sets the unique Agent identifier. It is the caller's responsibility to ensure that the new agent ID is globally unique.

Parameters:
agentId - The new Agent identifier.

isStartEventScheduled

public boolean isStartEventScheduled()
Returns true if this Application's "start" event has been scheduled.

Returns:
True if this Application's "start" event has been scheduled.

setStartEventScheduled

public void setStartEventScheduled(boolean startEventScheduled)
Sets the status of the "start" event in the event schedule.

Parameters:
startEventScheduled - True or False whether the "start" event has been scheduled.

isStopEventScheduled

public boolean isStopEventScheduled()
Returns the status of the "stop" event in the event schedule.

Returns:
True or False whether the "stop" event has been scheduled.

setStopEventScheduled

public void setStopEventScheduled(boolean stopEventScheduled)
Sets the status of the "start" event in the event schedule.

Parameters:
stopEventScheduled - True or False whether the "stop" event has been scheduled.

getAcceptableAgents

public java.util.Vector<java.lang.String> getAcceptableAgents()
Returns a Vector of the acceptable agents on which the current Application may attach. @see Vector

Returns:
A Vector of the acceptable agents on which the current Application may attach. @see Vector

setProperties

public abstract void setProperties()
Sets the current Applications properties.


setAcceptableConnectAgents

protected abstract void setAcceptableConnectAgents()
Sets the acceptable agents on which the current Application may be attached.


addApplicationToScript

public abstract java.lang.String addApplicationToScript(NsNode node,
                                                        int agentElement)
Adds the current Application to the TCL script.

Parameters:
node - The node on which the current Application resides.
agentElement - The index of the agent on which the Application is attached.
Returns:
The current Application to the TCL script.