com.ontimize.util.gis.client.defaultimplementations
Class DefaultGisDataDispatcher

java.lang.Object
  extended by com.ontimize.util.gis.client.defaultimplementations.DefaultGisDataDispatcher
All Implemented Interfaces:
IGisDataDispatcher

public class DefaultGisDataDispatcher
extends java.lang.Object
implements IGisDataDispatcher

Gis data dispatcher default implementation


Nested Class Summary
protected  class DefaultGisDataDispatcher.RequestsRemovalThread
           
 
Field Summary
protected  boolean DEBUG
           
protected  IDispatchQuery dispatchQuery
           
protected  DispatchThread dispatchThread
           
protected static java.lang.String LAST_REQUEST_TIME_ACCESS
           
protected  java.util.Map<java.lang.Object,java.util.List<java.lang.Object[]>> pendingData
           
protected  java.util.Map<java.lang.Object,java.lang.Integer> pendingFragments
           
protected  java.util.Map<java.lang.Object,java.util.Hashtable<java.lang.String,java.lang.Object>> pendingRequests
           
protected  DefaultGisDataDispatcher.RequestsRemovalThread removeThread
           
protected  java.util.List<RequestsChangeListener> requestsListeners
           
protected static long timeLimit
           
 
Fields inherited from interface com.ontimize.util.gis.client.interfaces.IGisDataDispatcher
DISPATCHER_FINAL_FRAGMENT
 
Constructor Summary
DefaultGisDataDispatcher()
           
 
Method Summary
protected  void addLog(java.lang.Object o, int level)
          Add a new log message with the given priority level value
 void addPendingRequest(java.util.Hashtable<?,?> request)
          Add a new request to the pending requests list in the data dispatcher
 void addPendingRequest(java.util.Hashtable<?,?> request, int totalFragments)
          Add a new request to the pending requests list in the data dispatcher
 void addPendingRequestsListener(RequestsChangeListener reqListener)
          Adds a listener for pending requests change events
 void dispatchData(java.lang.Object requester, java.lang.Object layerKeys, java.lang.Object appliedFilters, java.lang.Object data)
          Send the data resulting from queries to the requester class
protected  void fireRequestsListeners(RequestsChangeEvent ev)
           
 java.lang.Object getDispatchData()
           
protected  long getTimeFromLastRequest(int ticketNumber)
           
 int getTotalPendingFragments()
          Get total pending fragments of all the applicattion gis components
 int getTotalPendingFragments(java.lang.Object layersConfigurationId)
          Get total pending fragments for the given configuration
 void removePendingRequestsListener(RequestsChangeListener reqListener)
          Removes a listener for pending requestschange events
 void removeRequest(int ticketNumber)
          Remove the given request
protected  void removeTicketData(int ticketNumber)
          Remove all pending data related to a given request ticket number.
 void setTotalFragments(java.util.Hashtable<?,?> request, int totalFragments)
          Set the total requested fragments for the given request
protected  void updateLastRequestTime(int ticketNumber)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dispatchQuery

protected IDispatchQuery dispatchQuery

dispatchThread

protected DispatchThread dispatchThread

pendingRequests

protected java.util.Map<java.lang.Object,java.util.Hashtable<java.lang.String,java.lang.Object>> pendingRequests

pendingFragments

protected java.util.Map<java.lang.Object,java.lang.Integer> pendingFragments

pendingData

protected java.util.Map<java.lang.Object,java.util.List<java.lang.Object[]>> pendingData

DEBUG

protected boolean DEBUG

LAST_REQUEST_TIME_ACCESS

protected static java.lang.String LAST_REQUEST_TIME_ACCESS

timeLimit

protected static long timeLimit

removeThread

protected DefaultGisDataDispatcher.RequestsRemovalThread removeThread

requestsListeners

protected java.util.List<RequestsChangeListener> requestsListeners
Constructor Detail

DefaultGisDataDispatcher

public DefaultGisDataDispatcher()
Method Detail

dispatchData

public void dispatchData(java.lang.Object requester,
                         java.lang.Object layerKeys,
                         java.lang.Object appliedFilters,
                         java.lang.Object data)
Description copied from interface: IGisDataDispatcher
Send the data resulting from queries to the requester class

Specified by:
dispatchData in interface IGisDataDispatcher
Parameters:
requester - Reference to the requester class
layerKeys - Gis layer reference
appliedFilters - Previous query applied filters * @param data Data to send to the requester

getDispatchData

public java.lang.Object getDispatchData()
Specified by:
getDispatchData in interface IGisDataDispatcher

addPendingRequest

public void addPendingRequest(java.util.Hashtable<?,?> request,
                              int totalFragments)
Description copied from interface: IGisDataDispatcher
Add a new request to the pending requests list in the data dispatcher

Specified by:
addPendingRequest in interface IGisDataDispatcher
Parameters:
request - Pending request data
totalFragments - Number of fragments that compose the request

addPendingRequest

public void addPendingRequest(java.util.Hashtable<?,?> request)
Description copied from interface: IGisDataDispatcher
Add a new request to the pending requests list in the data dispatcher

Specified by:
addPendingRequest in interface IGisDataDispatcher
Parameters:
request - Pending request data

setTotalFragments

public void setTotalFragments(java.util.Hashtable<?,?> request,
                              int totalFragments)
Description copied from interface: IGisDataDispatcher
Set the total requested fragments for the given request

Specified by:
setTotalFragments in interface IGisDataDispatcher
Parameters:
request - Pending request data
totalFragments - Number of fragments that compose the request

removeTicketData

protected void removeTicketData(int ticketNumber)
Remove all pending data related to a given request ticket number. All future incoming data with this ticket number will be discarded

Parameters:
ticketNumber -

getTotalPendingFragments

public int getTotalPendingFragments()
Description copied from interface: IGisDataDispatcher
Get total pending fragments of all the applicattion gis components

Specified by:
getTotalPendingFragments in interface IGisDataDispatcher

getTotalPendingFragments

public int getTotalPendingFragments(java.lang.Object layersConfigurationId)
Description copied from interface: IGisDataDispatcher
Get total pending fragments for the given configuration

Specified by:
getTotalPendingFragments in interface IGisDataDispatcher
Parameters:
layersConfigurationId - Layers configuration
Returns:
Pending fragments for the given configuration

addLog

protected void addLog(java.lang.Object o,
                      int level)
Add a new log message with the given priority level value

Parameters:
o - Log message
level - Priority level

updateLastRequestTime

protected void updateLastRequestTime(int ticketNumber)

getTimeFromLastRequest

protected long getTimeFromLastRequest(int ticketNumber)

removeRequest

public void removeRequest(int ticketNumber)
Description copied from interface: IGisDataDispatcher
Remove the given request

Specified by:
removeRequest in interface IGisDataDispatcher
Parameters:
ticketNumber - Request ticket number

addPendingRequestsListener

public void addPendingRequestsListener(RequestsChangeListener reqListener)
Description copied from interface: IGisDataDispatcher
Adds a listener for pending requests change events

Specified by:
addPendingRequestsListener in interface IGisDataDispatcher
Parameters:
reqListener - Pending requests change events listener to add

removePendingRequestsListener

public void removePendingRequestsListener(RequestsChangeListener reqListener)
Description copied from interface: IGisDataDispatcher
Removes a listener for pending requestschange events

Specified by:
removePendingRequestsListener in interface IGisDataDispatcher
Parameters:
reqListener - Pending requests change events listener to add

fireRequestsListeners

protected void fireRequestsListeners(RequestsChangeEvent ev)