org.astrogrid.samp.gui
Class MessageTrackerHubService

java.lang.Object
  extended by org.astrogrid.samp.hub.BasicHubService
      extended by org.astrogrid.samp.gui.GuiHubService
          extended by org.astrogrid.samp.gui.MessageTrackerHubService
All Implemented Interfaces:
ClientProfile, HubService

public class MessageTrackerHubService
extends GuiHubService

GuiHubService subclass which additionally keeps track of which messages have been sent and received, and can provide a graphical display of these. The overhead in maintaining the GUI display can be significant if there is high volume of message traffic.

Since:
20 Nov 2008
Author:
Mark Taylor

Field Summary
 
Fields inherited from class org.astrogrid.samp.hub.BasicHubService
MAX_TIMEOUT, MAX_WAITERS
 
Constructor Summary
MessageTrackerHubService(Random random)
          Constructs a hub service with default message tracker GUI expiry times.
MessageTrackerHubService(Random random, int listRemoveDelay, int tableRemoveDelay, int tableMaxRows)
          Constructs a hub service with specified message tracker GUI expiry times.
 
Method Summary
 HubClient createClient(String publicId)
          Factory method used to create all the client objects which will be used by this hub service.
 ClientSet createClientSet()
          Factory method used to create the client set used by this hub service.
 JComponent createHubPanel()
          Creates a new component containing a display of the current hub internal state.
 ListModel getRxListModel(Client client)
          Returns a ListModel representing the pending messages received by a given client.
 ListModel getTxListModel(Client client)
          Returns a ListModel representing the pending messages sent from a given client.
protected  void reply(HubClient caller, String msgId, Map response)
          Does the work for the reply method of connections registered with this service.
 void start()
          Begin operation.
 
Methods inherited from class org.astrogrid.samp.gui.GuiHubService
createHubWindow, declareMetadata, declareSubscriptions, getClientListModel
 
Methods inherited from class org.astrogrid.samp.hub.BasicHubService
call, callAll, callAndWait, createConnection, disconnect, getClientSet, getIdComparator, getMetadata, getRegisteredClients, getServiceConnection, getSubscribedClients, getSubscriptions, isHubRunning, notify, notifyAll, register, setCallable, shutdown, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageTrackerHubService

public MessageTrackerHubService(Random random)
Constructs a hub service with default message tracker GUI expiry times.

Parameters:
random - random number generator

MessageTrackerHubService

public MessageTrackerHubService(Random random,
                                int listRemoveDelay,
                                int tableRemoveDelay,
                                int tableMaxRows)
Constructs a hub service with specified message tracker GUI expiry times. The delay times are times in milliseconds after message resolution before message representations expire and hence remove themselves from gui components.

Parameters:
random - random number generator
listRemoveDelay - expiry delay for summary icons in client list display
tableRemoveDelay - expiry delay for rows in message table display
tableMaxRows - maximum number of rows in message table (beyond this limit resolved messages may be removed early)
Method Detail

start

public void start()
Description copied from interface: HubService
Begin operation. The HubService.register() method should not be called until the hub has been started.

Specified by:
start in interface HubService
Overrides:
start in class GuiHubService

createClientSet

public ClientSet createClientSet()
Description copied from class: BasicHubService
Factory method used to create the client set used by this hub service.

Overrides:
createClientSet in class GuiHubService
Returns:
client set

createClient

public HubClient createClient(String publicId)
Description copied from class: BasicHubService
Factory method used to create all the client objects which will be used by this hub service.

Overrides:
createClient in class BasicHubService
Parameters:
publicId - client public ID
Returns:
hub client

createHubPanel

public JComponent createHubPanel()
Description copied from class: GuiHubService
Creates a new component containing a display of the current hub internal state.

Overrides:
createHubPanel in class GuiHubService
Returns:
new hub viewer panel

getTxListModel

public ListModel getTxListModel(Client client)
Returns a ListModel representing the pending messages sent from a given client. Elements of the model are Transmission objects.

Parameters:
client - client owned by this hub service
Returns:
transmission list model

getRxListModel

public ListModel getRxListModel(Client client)
Returns a ListModel representing the pending messages received by a given client. Elements of the model are Transmission objects.

Parameters:
client - client owned by this hub service
Returns:
transmission list model

reply

protected void reply(HubClient caller,
                     String msgId,
                     Map response)
              throws SampException
Description copied from class: BasicHubService
Does the work for the reply method of connections registered with this service.

Overrides:
reply in class BasicHubService
Parameters:
caller - calling client
msgId - message ID
response - response to forward
Throws:
SampException
See Also:
HubConnection.reply(java.lang.String, java.util.Map)


Copyright © 2008-2011 AstroGrid. All Rights Reserved.