Пример #1
0
  @Override
  public void onCreate() {
    super.onCreate();

    try {
      cacheManager = createCacheManager(getApplication());
    } catch (CacheCreationException e) {
      Ln.e(e);
      stopSelf();
      return;
    }
    if (cacheManager == null) {
      Ln.e(new CacheCreationException("createCacheManager() can't create a null cacheManager"));
      stopSelf();
      return;
    }

    progressReporter = createRequestRequestListenerNotifier();
    spiceServiceListenerNotifier = createSpiceServiceListenerNotifier();

    final ExecutorService executorService = getExecutorService();
    final NetworkStateChecker networkStateChecker = getNetworkStateChecker();

    requestProcessor = createRequestProcessor(executorService, networkStateChecker);
    requestProcessor.setFailOnCacheError(DEFAULT_FAIL_ON_CACHE_ERROR);

    notification = createDefaultNotification();

    Ln.d("SpiceService instance created.");
  }
Пример #2
0
 public void removeSpiceServiceListener(final SpiceServiceListener spiceServiceListener) {
   requestProcessor.removeSpiceServiceListener(spiceServiceListener);
 }
Пример #3
0
 public void dumpState() {
   Ln.v(requestProcessor.toString());
 }
Пример #4
0
 public void addSpiceServiceListener(final SpiceServiceListener spiceServiceListener) {
   requestProcessor.addSpiceServiceListener(spiceServiceListener);
 }
Пример #5
0
 public void setFailOnCacheError(final boolean failOnCacheError) {
   requestProcessor.setFailOnCacheError(failOnCacheError);
 }
Пример #6
0
 public void dontNotifyRequestListenersForRequest(
     final CachedSpiceRequest<?> request,
     final Collection<RequestListener<?>> listRequestListener) {
   requestProcessor.dontNotifyRequestListenersForRequest(request, listRequestListener);
 }
Пример #7
0
 public boolean isFailOnCacheError() {
   return requestProcessor.isFailOnCacheError();
 }
Пример #8
0
 public void removeAllDataFromCache() {
   requestProcessor.removeAllDataFromCache();
 }
Пример #9
0
 public void removeAllDataFromCache(final Class<?> clazz) {
   requestProcessor.removeAllDataFromCache(clazz);
 }
Пример #10
0
 public boolean removeDataFromCache(final Class<?> clazz, final Object cacheKey) {
   return requestProcessor.removeDataFromCache(clazz, cacheKey);
 }
Пример #11
0
 public void addRequest(
     final CachedSpiceRequest<?> request, final Set<RequestListener<?>> listRequestListener) {
   currentPendingRequestCount++;
   requestProcessor.addRequest(request, listRequestListener);
   showNotificationIfNotBoundAndHasPendingRequestsOtherwiseHideNotification();
 }