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
- List of announcements to make, keyed by session identifier.
-
DEFAULT_ADDRESS
- SAP default multicast socket address.
-
DEFAULT_PORT
- SAP default port number.
-
DELETE_ANNOUNCE_COUNTER
- Number of deletion announcement to be sent by default.
-
DELETE_INTERVAL
- Interval between deleion announcement:
-
eventManager
- The event manager for handling announcements.
-
handler
- The announce handler.
-
MIN_INTERVAL
- Minimum announcement interval, in milliseconds.
-
port
- Our port number.
-
SAP_VERSION
- SAP version handled by this implementation.
-
socket
- The SAP multicast socket.
-
announce(Announce)
- Make a session announcement.
-
createSession(String, long, long, String, String, InetAddress, String)
- Create a blank session, to be filled out by the caller.
-
decode(byte[], int, int)
- Decode a SAP packet.
-
delete(SapSession)
- Delete, and announce deletion of a session.
-
enumerateSessions()
- Enumerate all registered sessions.
-
getManager()
- Get the default SAP manager for this application.
-
getManager(InetAddress, int)
- Get a SAP manager for the given address/port pair.
-
handleTimerEvent(Object, long)
- EventHandler implementation - An annouce is to be made right now.
-
main(String[])
-
-
run()
-
-
startAnnounce(SapSession, long)
- Add the given session to the list of sessions to be announced.
-
stopAnnounce(SapSession)
- Stop announcing the given session.
-
testingSession(SapManager)
-
DEFAULT_ADDRESS
public static InetAddress DEFAULT_ADDRESS
- SAP default multicast socket address.
DEFAULT_PORT
public static final int DEFAULT_PORT
- SAP default port number.
SAP_VERSION
public static final int SAP_VERSION
- SAP version handled by this implementation.
DELETE_INTERVAL
public static final long DELETE_INTERVAL
- Interval between deleion announcement:
DELETE_ANNOUNCE_COUNTER
public static final int DELETE_ANNOUNCE_COUNTER
- Number of deletion announcement to be sent by default.
MIN_INTERVAL
public static final long MIN_INTERVAL
- Minimum announcement interval, in milliseconds.
socket
protected MulticastSocket socket
- The SAP multicast socket.
port
protected int port
- Our port number.
announces
protected Hashtable announces
- List of announcements to make, keyed by session identifier.
eventManager
protected EventManager eventManager
- The event manager for handling announcements.
handler
protected SapHandler handler
- The announce handler.
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
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
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
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
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
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
public void delete(SapSession s)
- Delete, and announce deletion of a session.
- Parameters:
- s - The session description to announce deletion of.
stopAnnounce
public void stopAnnounce(SapSession s)
- Stop announcing the given session.
- Parameters:
- s - The session whose periodic announce is to stop.
enumerateSessions
public Enumeration enumerateSessions()
- Enumerate all registered sessions.
- Returns:
- A Enumeration of SapSession instances.
announce
protected void announce(Announce a) throws IOException, UnknownHostException
- Make a session announcement.
- Parameters:
- a - The announcement to be made.
run
public void run()
- Overrides:
- run in class Thread
testingSession
public static SapSession testingSession(SapManager engine) throws UnknownHostException
main
public static void main(String args[])
All Packages Class Hierarchy This Package Previous Next Index