|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcore.Application
public abstract class Application
Base class for applications. Nodes that have an application running will
forward all incoming messages to the application handle()
method before they are processed further. The application can change the
properties of the message before returning it or return null to signal
to the router that it wants the message to be dropped.
In addition, the application's update()
method is called every
simulation cycle.
Configuration of application is done by picking a unique application instance
name (e.g., mySimpleApp) and setting its type
property to the
concrete application class: mySimpleApp.type = SimpleApplication
. These application instances can be assigned to node groups using the
Group.application
setting: Group1.application =
mySimpleApp
.
Field Summary | |
---|---|
java.lang.String |
appID
|
Constructor Summary | |
---|---|
Application()
|
|
Application(Application app)
Copy constructor. |
Method Summary | |
---|---|
java.lang.String |
getAppID()
Returns an unique application ID. |
java.util.List<ApplicationListener> |
getAppListeners()
|
abstract Message |
handle(Message msg,
DTNHost host)
This method handles application functionality related to processing of the bundle. |
abstract Application |
replicate()
|
void |
sendEventToListeners(java.lang.String event,
java.lang.Object params,
DTNHost host)
Sends an event to all listeners. |
void |
setAppID(java.lang.String appID)
Sets the application ID. |
void |
setAppListeners(java.util.List<ApplicationListener> aListeners)
|
abstract void |
update(DTNHost host)
Called every simulation cycle. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public java.lang.String appID
Constructor Detail |
---|
public Application()
public Application(Application app)
app
- Method Detail |
---|
public abstract Message handle(Message msg, DTNHost host)
msg
- The incoming message.host
- The host this application instance is attached to.
null
if the application wants the router to stop forwarding the
message.public abstract void update(DTNHost host)
host
- The host this application instance is attached to.public java.lang.String getAppID()
Returns an unique application ID. The application will only receive
messages with this application ID. If the AppID is set to
null
the application will receive all messages.
public void setAppID(java.lang.String appID)
appID
- public abstract Application replicate()
public void setAppListeners(java.util.List<ApplicationListener> aListeners)
public java.util.List<ApplicationListener> getAppListeners()
public void sendEventToListeners(java.lang.String event, java.lang.Object params, DTNHost host)
event
- The event to send.params
- Any additional parameters to send.host
- The host which where the app is running.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |