org.kaariboga.plugins.domainPlugIn
Class DomainPlugIn
java.lang.Object
|
+--org.kaariboga.core.Kaariboga
|
+--org.kaariboga.plugin.KbPlugIn
|
+--org.kaariboga.plugins.domainPlugIn.DomainPlugIn
- All Implemented Interfaces:
- KbMessageHandler, java.lang.Runnable, java.io.Serializable
- public class DomainPlugIn
- extends KbPlugIn
- implements java.io.Serializable
An example for the implementation of a plug-in.
- See Also:
- Serialized Form
Field Summary |
private KaaribogaAddress |
domainServer
Address of the domain server |
private long |
interval
How many milliseconds to wait between sending of messages |
private java.lang.String[] |
messageTypes
The message types, this plug-in can handle |
(package private) java.util.Hashtable |
servers
hashtable containing the server names and addresses. |
private DomainService |
service
A class that provides a set of methods. |
Constructor Summary |
DomainPlugIn(java.lang.String name)
Initialize the plug-in with name and a service name.
|
Method Summary |
java.lang.String[] |
getMessageTypes()
Get the message types, this plug-in can handle.
|
java.lang.Object |
getService(java.lang.String name)
This method returns an object, that can be used by agents or
the server itself.
|
void |
handleMessage(KaaribogaMessage msg)
overwrite handleMessage in Kaariboga |
void |
run()
Notifies the domain server every interval milliseconds |
void |
setProperties(java.util.Properties props)
Set configuration options for this plug-in. |
Methods inherited from class org.kaariboga.core.Kaariboga |
addKaaribogaListener, addKaaribogaMessageListener, fireDestroyRequest, fireDispatchRequest, fireKaaribogaMessage, fireSleepRequest, getDestination, getName, onArrival, onAwake, onCreate, onDestroy, onDispatch, onSleep, setBase, toString |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait |
service
private DomainService service
- A class that provides a set of methods.
interval
private long interval
- How many milliseconds to wait between sending of messages
domainServer
private KaaribogaAddress domainServer
- Address of the domain server
servers
java.util.Hashtable servers
- hashtable containing the server names and addresses.
messageTypes
private java.lang.String[] messageTypes
- The message types, this plug-in can handle
DomainPlugIn
public DomainPlugIn(java.lang.String name)
- Initialize the plug-in with name and a service name.
A service name is an identifier, which can be used by agents
to find a specific plug-in.
The name is just a unique Id.
- Parameters:
name
- Unique Id for this instance.
getService
public java.lang.Object getService(java.lang.String name)
- This method returns an object, that can be used by agents or
the server itself.
An agent usually searches for a service name and checks if the
object this method returns is of the type it expects.
- Overrides:
getService
in class KbPlugIn
- Returns:
- An object, that implements a set of service specific methods.
run
public void run()
- Notifies the domain server every interval milliseconds
- Overrides:
run
in class Kaariboga
setProperties
public void setProperties(java.util.Properties props)
- Set configuration options for this plug-in.
- Overrides:
setProperties
in class KbPlugIn
- Parameters:
props
- Properties for this plug-in.
getMessageTypes
public java.lang.String[] getMessageTypes()
- Get the message types, this plug-in can handle.
The messages will be registered at a KaaribogaBase.
The base will delegate appropriate messages to the
right plug-in.
- Overrides:
getMessageTypes
in class KbPlugIn
- Returns:
- An array with the names of the messages
handleMessage
public void handleMessage(KaaribogaMessage msg)
- overwrite handleMessage in Kaariboga
- Overrides:
handleMessage
in class Kaariboga