All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class w3c.www.sap.SapManager
java.lang.Object
   |
   +----java.lang.Thread
           |
           +----w3c.www.sap.SapManager
  -  public class SapManager
  -  extends Thread
  -  implements EventHandler
The SAP engine will both announce sessions, and handle declared sessions.
   
  -   announces announces
-   List of announcements to make, keyed by session identifier.
  
-   DEFAULT_ADDRESS DEFAULT_ADDRESS
-   SAP default multicast socket address.
  
-   DEFAULT_PORT DEFAULT_PORT
-   SAP default port number.
  
-   DELETE_ANNOUNCE_COUNTER DELETE_ANNOUNCE_COUNTER
-   Number of deletion announcement to be sent by default.
  
-   DELETE_INTERVAL DELETE_INTERVAL
-   Interval between deleion announcement:
  
-   eventManager eventManager
-   The event manager for handling announcements.
  
-   handler handler
-   The announce handler.
  
-   MIN_INTERVAL MIN_INTERVAL
-   Minimum announcement interval, in milliseconds.
  
-   port port
-   Our port number.
  
-   SAP_VERSION SAP_VERSION
-   SAP version handled by this implementation.
  
-   socket socket
-   The SAP multicast socket.
   
  -   announce(Announce) announce(Announce)
-   Make a session announcement.
  
-   createSession(String, long, long, String, String, InetAddress, String) createSession(String, long, long, String, String, InetAddress, String)
-   Create a blank session, to be filled out by the caller.
  
-   decode(byte[], int, int) decode(byte[], int, int)
-   Decode a SAP packet.
  
-   delete(SapSession) delete(SapSession)
-   Delete, and announce deletion of a session.
  
-   enumerateSessions() enumerateSessions()
-   Enumerate all registered sessions.
  
-   getManager() getManager()
-   Get the default SAP manager for this application.
  
-   getManager(InetAddress, int) getManager(InetAddress, int)
-   Get a SAP manager for the given address/port pair.
  
-   handleTimerEvent(Object, long) handleTimerEvent(Object, long)
-   EventHandler implementation - An annouce is to be made right now.
  
-   main(String[]) main(String[])
-  
  
-   run() run()
-  
  
-   startAnnounce(SapSession, long) startAnnounce(SapSession, long)
-   Add the given session to the list of sessions to be announced.
  
-   stopAnnounce(SapSession) stopAnnounce(SapSession)
-   Stop announcing the given session.
  
-   testingSession(SapManager) testingSession(SapManager)
-  
   
 DEFAULT_ADDRESS
DEFAULT_ADDRESS
 public static InetAddress DEFAULT_ADDRESS
  -  SAP default multicast socket address.
 
 DEFAULT_PORT
DEFAULT_PORT
 public static final int DEFAULT_PORT
  -  SAP default port number.
 
 SAP_VERSION
SAP_VERSION
 public static final int SAP_VERSION
  -  SAP version handled by this implementation.
 
 DELETE_INTERVAL
DELETE_INTERVAL
 public static final long DELETE_INTERVAL
  -  Interval between deleion announcement:
 
 DELETE_ANNOUNCE_COUNTER
DELETE_ANNOUNCE_COUNTER
 public static final int DELETE_ANNOUNCE_COUNTER
  -  Number of deletion announcement to be sent by default.
 
 MIN_INTERVAL
MIN_INTERVAL
 public static final long MIN_INTERVAL
  -  Minimum announcement interval, in milliseconds.
 
 socket
socket
 protected MulticastSocket socket
  -  The SAP multicast socket.
 
 port
port
 protected int port
  -  Our port number.
 
 announces
announces
 protected Hashtable announces
  -  List of announcements to make, keyed by session identifier.
 
 eventManager
eventManager
 protected EventManager eventManager
  -  The event manager for handling announcements.
 
 handler
handler
 protected SapHandler handler
  -  The announce handler.
 
   
 decode
decode
 protected SapSession decode(byte buf[],
                             int off,
                             int len)
  -  Decode a SAP packet.
   
- 
    -  Parameters:
    
-  buf - The buffer containing the packet.
    -  off - Offset of packet within above buffer.
    -  len - Length of packet.
    
-  Returns:
    
-  A SapSession instance, or null if this was
 a Session Description Deletion.
  
 
 getManager
getManager
 public static synchronized SapManager getManager() throws IOException
  -  Get the default SAP manager for this application.
   
- 
    -  Returns:
    
-  A SapManager instance.
    
-  Throws: IOException
    
-  If the manager couldn't create the multicast
 socket to join the SAP channel.
  
 
 getManager
getManager
 public static synchronized SapManager getManager(InetAddress a,
                                                  int p) throws IOException
  -  Get a SAP manager for the given address/port pair.
 The same manager will be returned for the same pairs.
   
- 
    -  Parameters:
    
-  A - The SAP Inet address.
    -  p - The SAP port.
    
-  Returns:
    
-  A SapManager instance.
    
-  Throws: IOException
    
-  If the manager couldn't create the multicast
 socket to join the SAP channel.
  
 
 createSession
createSession
 public SapSession createSession(String username,
                                 long sid,
                                 long sversion,
                                 String snettype,
                                 String saddrtype,
                                 InetAddress saddr,
                                 String name)
  -  Create a blank session, to be filled out by the caller.
   
- 
    -  Parameters:
    
-  username - Owner of the session.
    -  sid - Session identifier.
    -  sversion - Version of that session.
    -  snettype - Session network type.
    -  saddrtype - Session address type.
    -  saddr - Session address.
    -  name - Session name.
  
 
 handleTimerEvent
handleTimerEvent
 public void handleTimerEvent(Object data,
                              long time)
  -  EventHandler implementation - An annouce is to be made right now.
   
- 
    -  Parameters:
    
-  data - The handler closure (a Announce instance).
    -  time - Current time.
  
 
 startAnnounce
startAnnounce
 public void startAnnounce(SapSession s,
                           long interval)
  -  Add the given session to the list of sessions to be announced.
   
- 
    -  Parameters:
    
-  s - The session to be announced.
    -  interval - The interval between two announcements in milliseconds.
  
 
 delete
delete
 public void delete(SapSession s)
  -  Delete, and announce deletion of a session.
   
- 
    -  Parameters:
    
-  s - The session description to announce deletion of.
  
 
 stopAnnounce
stopAnnounce
 public void stopAnnounce(SapSession s)
  -  Stop announcing the given session.
   
- 
    -  Parameters:
    
-  s - The session whose periodic announce is to stop.
  
 
 enumerateSessions
enumerateSessions
 public Enumeration enumerateSessions()
  -  Enumerate all registered sessions.
   
- 
    -  Returns:
    
-  A Enumeration of SapSession instances.
  
 
 announce
announce
 protected void announce(Announce a) throws IOException, UnknownHostException
  -  Make a session announcement.
   
- 
    -  Parameters:
    
-  a - The announcement to be made.
  
 
 run
run
 public void run()
  - 
    -  Overrides:
    
-  run in class Thread
  
 
 testingSession
testingSession
 public static SapSession testingSession(SapManager engine) throws UnknownHostException
 main
main
 public static void main(String args[])
All Packages  Class Hierarchy  This Package  Previous  Next  Index