Rename RemoteMessageStore to Backend

This commit is contained in:
cketti 2018-06-02 18:34:40 +02:00
parent 8499a95f5a
commit 03a54b0d98
3 changed files with 19 additions and 19 deletions

View file

@ -4,7 +4,7 @@ package com.fsck.k9.backend.api;
import com.fsck.k9.mail.Folder;
public interface RemoteMessageStore {
public interface Backend {
// TODO: Add a way to cancel the sync process
void sync(String folder, SyncConfig syncConfig, SyncListener listener, Folder providedRemoteFolder);
}

View file

@ -1,19 +1,19 @@
package com.fsck.k9.backend.imap;
import com.fsck.k9.backend.api.Backend;
import com.fsck.k9.backend.api.BackendStorage;
import com.fsck.k9.backend.api.RemoteMessageStore;
import com.fsck.k9.backend.api.SyncConfig;
import com.fsck.k9.backend.api.SyncListener;
import com.fsck.k9.mail.Folder;
import com.fsck.k9.mail.store.imap.ImapStore;
public class ImapMessageStore implements RemoteMessageStore {
public class ImapBackend implements Backend {
private final ImapSync imapSync;
public ImapMessageStore(String accountName, BackendStorage backendStorage, ImapStore imapStore) {
public ImapBackend(String accountName, BackendStorage backendStorage, ImapStore imapStore) {
this.imapSync = new ImapSync(accountName, backendStorage, imapStore);
}

View file

@ -49,7 +49,7 @@ import com.fsck.k9.activity.MessageReference;
import com.fsck.k9.activity.setup.AccountSetupCheckSettings.CheckDirection;
import com.fsck.k9.backend.api.BackendStorage;
import com.fsck.k9.backend.api.MessageRemovalListener;
import com.fsck.k9.backend.api.RemoteMessageStore;
import com.fsck.k9.backend.api.Backend;
import com.fsck.k9.backend.api.SyncConfig;
import com.fsck.k9.backend.api.SyncListener;
import com.fsck.k9.cache.EmailProviderCache;
@ -61,7 +61,7 @@ import com.fsck.k9.controller.MessagingControllerCommands.PendingMarkAllAsRead;
import com.fsck.k9.controller.MessagingControllerCommands.PendingMoveOrCopy;
import com.fsck.k9.controller.MessagingControllerCommands.PendingSetFlag;
import com.fsck.k9.controller.ProgressBodyFactory.ProgressListener;
import com.fsck.k9.backend.imap.ImapMessageStore;
import com.fsck.k9.backend.imap.ImapBackend;
import com.fsck.k9.helper.Contacts;
import com.fsck.k9.mail.Address;
import com.fsck.k9.mail.AuthenticationFailedException;
@ -143,7 +143,7 @@ public class MessagingController {
private final TransportProvider transportProvider;
private final AccountStatsCollector accountStatsCollector;
private final Map<String, ImapMessageStore> imapMessageStores = new HashMap<>();
private final Map<String, ImapBackend> imapBackends = new HashMap<>();
private MessagingListener checkMailListener = null;
@ -261,26 +261,26 @@ public class MessagingController {
throw new Error(e);
}
private RemoteMessageStore getRemoteMessageStore(Account account) {
return account.getStoreUri().startsWith("imap") ? getImapMessageStore(account) : null;
private Backend getBackend(Account account) {
return account.getStoreUri().startsWith("imap") ? getImapBackend(account) : null;
}
private ImapMessageStore getImapMessageStore(Account account) {
synchronized (imapMessageStores) {
ImapMessageStore imapMessageStore = imapMessageStores.get(account.getUuid());
if (imapMessageStore != null) {
return imapMessageStore;
private ImapBackend getImapBackend(Account account) {
synchronized (imapBackends) {
ImapBackend imapBackend = imapBackends.get(account.getUuid());
if (imapBackend != null) {
return imapBackend;
}
}
LocalStore localStore = getLocalStoreOrThrow(account);
synchronized (imapMessageStores) {
synchronized (imapBackends) {
BackendStorage backendStorage = new K9BackendStorage(localStore);
ImapStore remoteStore = (ImapStore) getRemoteStoreOrThrow(account);
String accountName = account.getDescription();
ImapMessageStore imapMessageStore = new ImapMessageStore(accountName, backendStorage, remoteStore);
imapMessageStores.put(account.getUuid(), imapMessageStore);
ImapBackend imapMessageStore = new ImapBackend(accountName, backendStorage, remoteStore);
imapBackends.put(account.getUuid(), imapMessageStore);
return imapMessageStore;
}
}
@ -772,7 +772,7 @@ public class MessagingController {
@VisibleForTesting
void synchronizeMailboxSynchronous(final Account account, final String folder, final MessagingListener listener,
Folder providedRemoteFolder) {
RemoteMessageStore remoteMessageStore = getRemoteMessageStore(account);
Backend remoteMessageStore = getBackend(account);
if (remoteMessageStore != null) {
syncFolder(account, folder, listener, providedRemoteFolder, remoteMessageStore);
} else {
@ -781,7 +781,7 @@ public class MessagingController {
}
private void syncFolder(Account account, String folder, MessagingListener listener, Folder providedRemoteFolder,
RemoteMessageStore remoteMessageStore) {
Backend remoteMessageStore) {
Exception commandException = null;
try {