Search in sources :

Example 1 with CacheCreationException

use of com.octo.android.robospice.persistence.exception.CacheCreationException in project robospice by stephanenicolas.

the class GoogleHttpClientSpiceTestService method createCacheManager.

@Override
public CacheManager createCacheManager(Application application) {
    CacheManager cacheManager = new CacheManager();
    try {
        JacksonObjectPersisterFactory jacksonObjectPersisterFactory = new JacksonObjectPersisterFactory(application, new File("/"));
        cacheManager.addPersister(jacksonObjectPersisterFactory);
    } catch (CacheCreationException e) {
        Ln.e(e);
    }
    return cacheManager;
}
Also used : JacksonObjectPersisterFactory(com.octo.android.robospice.persistence.googlehttpclient.json.JacksonObjectPersisterFactory) CacheCreationException(com.octo.android.robospice.persistence.exception.CacheCreationException) CacheManager(com.octo.android.robospice.persistence.CacheManager) File(java.io.File)

Example 2 with CacheCreationException

use of com.octo.android.robospice.persistence.exception.CacheCreationException in project robospice by stephanenicolas.

the class SpiceService method onCreate.

@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;
    }
    final RequestListenerNotifier progressReporter = createRequestRequestListenerNotifier();
    final SpiceServiceListenerNotifier spiceServiceListenerNotifier = createSpiceServiceListenerNotifier();
    final RequestProcessorListener requestProcessorListener = createRequestProcessorListener();
    final ExecutorService executorService = getExecutorService();
    final NetworkStateChecker networkStateChecker = getNetworkStateChecker();
    final RequestProgressManager requestProgressManager = createRequestProgressManager(requestProcessorListener, progressReporter, spiceServiceListenerNotifier);
    final RequestRunner requestRunner = createRequestRunner(executorService, networkStateChecker, requestProgressManager);
    requestProcessor = createRequestProcessor(cacheManager, requestProgressManager, requestRunner);
    requestProcessor.setFailOnCacheError(DEFAULT_FAIL_ON_CACHE_ERROR);
    notification = createDefaultNotification();
    isCreated = true;
    Ln.d("SpiceService instance created.");
}
Also used : DefaultRequestRunner(com.octo.android.robospice.request.DefaultRequestRunner) RequestRunner(com.octo.android.robospice.request.RequestRunner) RequestProcessorListener(com.octo.android.robospice.request.RequestProcessorListener) CacheCreationException(com.octo.android.robospice.persistence.exception.CacheCreationException) NetworkStateChecker(com.octo.android.robospice.networkstate.NetworkStateChecker) DefaultNetworkStateChecker(com.octo.android.robospice.networkstate.DefaultNetworkStateChecker) RequestListenerNotifier(com.octo.android.robospice.request.notifier.RequestListenerNotifier) DefaultRequestListenerNotifier(com.octo.android.robospice.request.notifier.DefaultRequestListenerNotifier) ExecutorService(java.util.concurrent.ExecutorService) RequestProgressManager(com.octo.android.robospice.request.RequestProgressManager) SpiceServiceListenerNotifier(com.octo.android.robospice.request.notifier.SpiceServiceListenerNotifier)

Aggregations

CacheCreationException (com.octo.android.robospice.persistence.exception.CacheCreationException)2 DefaultNetworkStateChecker (com.octo.android.robospice.networkstate.DefaultNetworkStateChecker)1 NetworkStateChecker (com.octo.android.robospice.networkstate.NetworkStateChecker)1 CacheManager (com.octo.android.robospice.persistence.CacheManager)1 JacksonObjectPersisterFactory (com.octo.android.robospice.persistence.googlehttpclient.json.JacksonObjectPersisterFactory)1 DefaultRequestRunner (com.octo.android.robospice.request.DefaultRequestRunner)1 RequestProcessorListener (com.octo.android.robospice.request.RequestProcessorListener)1 RequestProgressManager (com.octo.android.robospice.request.RequestProgressManager)1 RequestRunner (com.octo.android.robospice.request.RequestRunner)1 DefaultRequestListenerNotifier (com.octo.android.robospice.request.notifier.DefaultRequestListenerNotifier)1 RequestListenerNotifier (com.octo.android.robospice.request.notifier.RequestListenerNotifier)1 SpiceServiceListenerNotifier (com.octo.android.robospice.request.notifier.SpiceServiceListenerNotifier)1 File (java.io.File)1 ExecutorService (java.util.concurrent.ExecutorService)1