com.andreani.xtol.test
Class SnoopSpace

java.lang.Object
  |
  +--com.andreani.xtol.test.SnoopSpace
All Implemented Interfaces:
ServiceDiscoveryListener

public class SnoopSpace
extends Object
implements ServiceDiscoveryListener

Version:
1.0
Author:
Stefano Andreani

Field Summary
protected  Category cat
          Log handler (Log4Java)
 
Constructor Summary
SnoopSpace()
          Connects to the JavaSpaces that contain the SessionEntries and registers the listener for new spaces.
 
Method Summary
 void insertEmptyEntry(String sessionid, String server)
          Inserts an entry into the space with an empty hashtable.
static void main(String[] args)
           
 void populateSpace(int i)
          This method populate a new JavaSpace with SessionEntries contained in the other spaces.
 void serviceAdded(ServiceDiscoveryEvent evt)
           
 void serviceChanged(ServiceDiscoveryEvent event)
          Description of the Method
 void serviceRemoved(ServiceDiscoveryEvent event)
          Description of the Method
 Entry takeEntry()
          Takes an entry from the JavaSpace
 void terminate()
           
 void updateReferences(String oldAddr, String newAddr)
           
 void writeEntry(Entry entry)
          Description of the Method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cat

protected Category cat
Log handler (Log4Java)
Constructor Detail

SnoopSpace

public SnoopSpace()
Connects to the JavaSpaces that contain the SessionEntries and registers the listener for new spaces.
Method Detail

insertEmptyEntry

public void insertEmptyEntry(String sessionid,
                             String server)
Inserts an entry into the space with an empty hashtable.

takeEntry

public Entry takeEntry()
Takes an entry from the JavaSpace
Parameters:
sessionid - Id of the entry to take
Returns:
Found entry

serviceAdded

public void serviceAdded(ServiceDiscoveryEvent evt)
Specified by:
serviceAdded in interface ServiceDiscoveryListener

serviceRemoved

public void serviceRemoved(ServiceDiscoveryEvent event)
Description of the Method
Specified by:
serviceRemoved in interface ServiceDiscoveryListener
Parameters:
event - Description of Parameter

serviceChanged

public void serviceChanged(ServiceDiscoveryEvent event)
Description of the Method
Specified by:
serviceChanged in interface ServiceDiscoveryListener
Parameters:
event - Description of Parameter

writeEntry

public void writeEntry(Entry entry)
Description of the Method
Parameters:
entry - Description of Parameter

populateSpace

public void populateSpace(int i)
This method populate a new JavaSpace with SessionEntries contained in the other spaces. ServiceDiscoveryListener docs suggests to simply note the occurrence of the ServiceDiscoveryEvent, and perform any time consuming event handling asynchronously, so this method needs to be fast, otherwise it needs to be invoked asynchronously.
Parameters:
i - Index of the space to populate

updateReferences

public void updateReferences(String oldAddr,
                             String newAddr)

terminate

public void terminate()

main

public static void main(String[] args)


Copyright © 2001 Stefano Andreani - No Rights Reserved ;-)