com.octo.android.robospice.request
Class RequestProgressManager

java.lang.Object
  extended by com.octo.android.robospice.request.RequestProgressManager

public class RequestProgressManager
extends Object

Entity responsible for managing request's progress and notifying associated listeners of any progress change.

Author:
Andrew Clark

Constructor Summary
RequestProgressManager(RequestProcessorListener requestProcessorListener, RequestListenerNotifier requestListenerNotifier, SpiceServiceListenerNotifier spiceServiceListenerNotifier)
           
 
Method Summary
 void addSpiceServiceListener(SpiceServiceListener spiceServiceListener)
           
protected  void checkAllRequestComplete()
           
<T> RequestProgressListener
createProgressListener(CachedSpiceRequest<T> request)
           
 void dontNotifyRequestListenersForRequest(CachedSpiceRequest<?> request, Collection<RequestListener<?>> listRequestListener)
          Disable request listeners notifications for a specific request.
 int getPendingRequestCount()
           
<T> void
notifyListenersOfRequestAdded(CachedSpiceRequest<T> request, Set<RequestListener<?>> listeners)
           
<T> void
notifyListenersOfRequestAggregated(CachedSpiceRequest<T> request, Set<RequestListener<?>> listeners)
           
 void notifyListenersOfRequestCancellation(CachedSpiceRequest<?> request)
           
<T> void
notifyListenersOfRequestFailure(CachedSpiceRequest<T> request, SpiceException e)
           
 void notifyListenersOfRequestNotFound(CachedSpiceRequest<?> request, Set<RequestListener<?>> listeners)
           
<T> void
notifyListenersOfRequestProgress(CachedSpiceRequest<?> request, Set<RequestListener<?>> listeners, RequestProgress progress)
           
protected
<T> void
notifyListenersOfRequestProgress(CachedSpiceRequest<?> request, Set<RequestListener<?>> listeners, RequestStatus status)
           
<T> void
notifyListenersOfRequestSuccess(CachedSpiceRequest<T> request, T result)
           
<T> void
notifyListenersOfRequestSuccessButDontCompleteRequest(CachedSpiceRequest<T> request, T result)
           
 void notifyOfRequestProcessed(CachedSpiceRequest<?> request, Set<RequestListener<?>> listeners)
           
 void removeSpiceServiceListener(SpiceServiceListener spiceServiceListener)
           
 void setMapRequestToRequestListener(Map<CachedSpiceRequest<?>,Set<RequestListener<?>>> mapRequestToRequestListener)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestProgressManager

public RequestProgressManager(RequestProcessorListener requestProcessorListener,
                              RequestListenerNotifier requestListenerNotifier,
                              SpiceServiceListenerNotifier spiceServiceListenerNotifier)
Method Detail

setMapRequestToRequestListener

public void setMapRequestToRequestListener(Map<CachedSpiceRequest<?>,Set<RequestListener<?>>> mapRequestToRequestListener)

notifyListenersOfRequestNotFound

public void notifyListenersOfRequestNotFound(CachedSpiceRequest<?> request,
                                             Set<RequestListener<?>> listeners)

notifyListenersOfRequestAdded

public <T> void notifyListenersOfRequestAdded(CachedSpiceRequest<T> request,
                                              Set<RequestListener<?>> listeners)

notifyListenersOfRequestAggregated

public <T> void notifyListenersOfRequestAggregated(CachedSpiceRequest<T> request,
                                                   Set<RequestListener<?>> listeners)

notifyListenersOfRequestProgress

protected <T> void notifyListenersOfRequestProgress(CachedSpiceRequest<?> request,
                                                    Set<RequestListener<?>> listeners,
                                                    RequestStatus status)

notifyListenersOfRequestProgress

public <T> void notifyListenersOfRequestProgress(CachedSpiceRequest<?> request,
                                                 Set<RequestListener<?>> listeners,
                                                 RequestProgress progress)

checkAllRequestComplete

protected void checkAllRequestComplete()

notifyListenersOfRequestSuccessButDontCompleteRequest

public <T> void notifyListenersOfRequestSuccessButDontCompleteRequest(CachedSpiceRequest<T> request,
                                                                      T result)

notifyListenersOfRequestSuccess

public <T> void notifyListenersOfRequestSuccess(CachedSpiceRequest<T> request,
                                                T result)

notifyListenersOfRequestFailure

public <T> void notifyListenersOfRequestFailure(CachedSpiceRequest<T> request,
                                                SpiceException e)

notifyListenersOfRequestCancellation

public void notifyListenersOfRequestCancellation(CachedSpiceRequest<?> request)

dontNotifyRequestListenersForRequest

public void dontNotifyRequestListenersForRequest(CachedSpiceRequest<?> request,
                                                 Collection<RequestListener<?>> listRequestListener)
Disable request listeners notifications for a specific request.
All listeners associated to this request won't be called when request will finish.

Parameters:
request - Request on which you want to disable listeners
listRequestListener - the collection of listeners associated to request not to be notified

addSpiceServiceListener

public void addSpiceServiceListener(SpiceServiceListener spiceServiceListener)

removeSpiceServiceListener

public void removeSpiceServiceListener(SpiceServiceListener spiceServiceListener)

notifyOfRequestProcessed

public void notifyOfRequestProcessed(CachedSpiceRequest<?> request,
                                     Set<RequestListener<?>> listeners)

getPendingRequestCount

public int getPendingRequestCount()

createProgressListener

public <T> RequestProgressListener createProgressListener(CachedSpiceRequest<T> request)


Copyright © 2012-2014. All Rights Reserved.