|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcat.sig.SigManager
This class is the SigManager. SIGs are created, joined, and destroyed in here. The manager uses a SensorMonitor to get all sensor data, the sensor data is then distributed to the appropriate sig by means of nodes. Each node contains a sensor and all the sigs that share that sensor.
Field Summary | |
(package private) static int |
ESTABLISHED
|
private SensorMonitor |
monitor
Used to get sensor data from CAT to be shared in sigs. |
(package private) static int |
REFUSED
|
private java.util.Vector |
senList
List of listeners to this manager. |
private java.util.Vector |
sensorNodes
List of all nodes, used to match each CAT sensor with sigs for it. |
private java.util.Vector |
sigGroup
All sigs. |
Constructor Summary | |
SigManager()
This constructor initializes the SigManager by starting new empty sig lists, and initializing the SensorMonitor. |
Method Summary | |
void |
addAgent(java.lang.String sig_name,
Agent a)
This method adds an agent to a Sig, so that the agent gets shared sensor data from this CAT. |
int |
addAgentToSig(java.lang.String name,
Agent a,
java.util.Vector want_sensors)
This method is used to add an agent to a sig that already has been created. |
void |
addSensorSig(java.lang.String sig_name,
Sensor s)
This method adds a sensor to a Sig, so that it is shared to that sig. |
Sig |
addSig(java.lang.String name,
java.util.Vector se,
java.util.Vector a,
int encrypt,
int auth)
This method is used internally to create/add a new sig into this SigManager and CAT. |
void |
addSigListener(SigListener s)
This method adds a listener to this Manager. |
int |
createSig(java.lang.String name,
Agent a,
java.util.Vector want_sensors,
java.util.Vector my_sensors)
This method is used to create a new sig and try to get one other agent to join the sig. |
void |
deleteSigListener(SigListener s)
This method removes a listener to this Manager. |
private java.util.Vector |
findInterestedSig(java.lang.String id)
This method find Sig's that are interested in a particular sensor's data. |
Sig |
findSig(java.lang.String sig_name)
This method finds Sig that has a particular name or returns null if no sig exists with the given name. |
SensorMonitor |
getMonitor()
This method returns the SensorMonitor which is used to listen to all CAT sensors, so that some/none of the sensor data can be shared with SIGs. |
java.util.Vector |
getSigs()
This method returns all the sigs in CAT. |
void |
joinSig(java.lang.String name,
java.util.Vector se,
java.util.Vector all,
java.util.Vector a,
int encrypt,
int auth)
This method is used to join a sig that someone else has already created The CAT app should call this method, when the user decides to join a sig. |
void |
notifySigListeners(SigEvent event)
This method notifies all listeners of a sig data event. |
void |
removeAgent(java.lang.String sig_name,
Agent a)
This method removes an agent from a Sig, so that the agent no longer gets shared sensor data from this CAT. |
void |
removeSensor(Sensor s)
This method removes a sensor from all Sigs, so that it is no longer shared to any sigs. |
void |
removeSensorSig(java.lang.String sig_name,
Sensor s)
This method removes a sensor from a Sig, so that it is no longer shared to that sig. |
void |
removeSig(java.lang.String name)
This method is for removing a sig from the SigManager and from CAT. |
void |
send(SensorEvent event)
This method sends SensorEvent to interested Sig. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
static final int ESTABLISHED
static final int REFUSED
private java.util.Vector sigGroup
private SensorMonitor monitor
private java.util.Vector senList
private java.util.Vector sensorNodes
Constructor Detail |
public SigManager()
Method Detail |
public SensorMonitor getMonitor()
public int createSig(java.lang.String name, Agent a, java.util.Vector want_sensors, java.util.Vector my_sensors)
name
- The name for the new sig.a
- The first agent to send a join request to.want_sensors
- The shared sensors want for joining the sig.my_sensors
- The sensors being shared.public int addAgentToSig(java.lang.String name, Agent a, java.util.Vector want_sensors)
name
- The name of the sig.a
- The agent to send a join request to.want_sensors
- The shared sensors want for joining the sig.public Sig addSig(java.lang.String name, java.util.Vector se, java.util.Vector a, int encrypt, int auth)
name
- The name for the new sig.a
- The agents in the sig.se
- The shared sensors in the sig.encrypt
- Used for encryption of the sig.auth
- Used for authorization of the sig.public void removeSig(java.lang.String name)
name
- The name of the sig to remove.public void joinSig(java.lang.String name, java.util.Vector se, java.util.Vector all, java.util.Vector a, int encrypt, int auth)
name
- The name of the sig.se
- Sensor's we will share.all
- All sensors in the sig.a
- All agents in the sig.encrypt
- Used for encryption of the sig.auth
- Used for authorization of the sig.public void addAgent(java.lang.String sig_name, Agent a)
sig_name
- The name of sig to add the agent to.public void removeAgent(java.lang.String sig_name, Agent a)
sig_name
- The name of sig to remove the agent from.public void removeSensor(Sensor s)
s
- The sensor to remove.public void addSensorSig(java.lang.String sig_name, Sensor s)
sig_name
- The name of sig to add sensor to.s
- The sensor to add.public void removeSensorSig(java.lang.String sig_name, Sensor s)
sig_name
- The name of sig to remove sensor from.s
- The sensor to remove.public void send(SensorEvent event)
event
- The sensor data event to give to sigs.private java.util.Vector findInterestedSig(java.lang.String id)
id
- The id of the sensor to look for in sigs.
public Sig findSig(java.lang.String sig_name)
sig_name
- The name of the sig to find
public java.util.Vector getSigs()
public void addSigListener(SigListener s)
s
- listener.public void deleteSigListener(SigListener s)
s
- listener.public void notifySigListeners(SigEvent event)
event
- Sesnor data event.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |