From bccf0b55467a0b940b85bccdcb70bf7e7cba3f32 Mon Sep 17 00:00:00 2001 From: cketti Date: Tue, 7 Jun 2011 16:09:15 +0200 Subject: [PATCH] Renamed class StoreSettings to ServerSettings --- src/com/fsck/k9/mail/ConnectionSecurity.java | 7 +-- ...StoreSettings.java => ServerSettings.java} | 51 ++++++++++--------- src/com/fsck/k9/mail/Store.java | 6 +-- src/com/fsck/k9/mail/store/ImapStore.java | 4 +- src/com/fsck/k9/mail/store/Pop3Store.java | 6 +-- src/com/fsck/k9/mail/store/WebDavStore.java | 2 +- .../fsck/k9/preferences/StorageExporter.java | 4 +- 7 files changed, 42 insertions(+), 38 deletions(-) rename src/com/fsck/k9/mail/{StoreSettings.java => ServerSettings.java} (58%) diff --git a/src/com/fsck/k9/mail/ConnectionSecurity.java b/src/com/fsck/k9/mail/ConnectionSecurity.java index 2fae9ff50..98741303e 100644 --- a/src/com/fsck/k9/mail/ConnectionSecurity.java +++ b/src/com/fsck/k9/mail/ConnectionSecurity.java @@ -4,9 +4,10 @@ package com.fsck.k9.mail; * The currently available connection security types. * *

- * Right now this enum is only used by {@link StoreSettings} and converted to store-specific - * constants in the different Store implementations. In the future we probably want to change this - * and use {@code ConnectionSecurity} exclusively. + * Right now this enum is only used by {@link ServerSettings} and converted to store- or + * transport-specific constants in the different {@link Store} and {@link Transport} + * implementations. In the future we probably want to change this and use + * {@code ConnectionSecurity} exclusively. *

*/ public enum ConnectionSecurity { diff --git a/src/com/fsck/k9/mail/StoreSettings.java b/src/com/fsck/k9/mail/ServerSettings.java similarity index 58% rename from src/com/fsck/k9/mail/StoreSettings.java rename to src/com/fsck/k9/mail/ServerSettings.java index 77bdc064a..cb36459c6 100644 --- a/src/com/fsck/k9/mail/StoreSettings.java +++ b/src/com/fsck/k9/mail/ServerSettings.java @@ -4,79 +4,82 @@ import java.util.Map; import com.fsck.k9.Account; /** - * This is an abstraction to get rid of the store-specific URIs. + * This is an abstraction to get rid of the store- and transport-specific URIs. * *

* Right now it's only used for settings import/export. But the goal is to get rid of - * store URIs altogether. + * store/transport URIs altogether. *

* * @see Account#getStoreUri() + * @see Account#getTransportUri() */ -public class StoreSettings { +public class ServerSettings { /** - * Name of the store type (e.g. "IMAP"). + * Name of the store or transport type (e.g. "IMAP"). */ public final String type; /** - * The host name of the incoming server. + * The host name of the server. + * + * {@code null} if not applicable for the store or transport. */ public final String host; /** - * The port number of the incoming server. + * The port number of the server. */ public final int port; /** - * The type of connection security to be used when connecting to the incoming server. + * The type of connection security to be used when connecting to the server. * - * {@link ConnectionSecurity#NONE} if not applicable for the store. + * {@link ConnectionSecurity#NONE} if not applicable for the store or transport. */ public final ConnectionSecurity connectionSecurity; /** - * The authentication method to use when connecting to the incoming server. + * The authentication method to use when connecting to the server. * - * {@code null} if not applicable for the store. + * {@code null} if not applicable for the store or transport. */ public final String authenticationType; /** - * The username part of the credentials needed to authenticate to the incoming server. + * The username part of the credentials needed to authenticate to the server. * - * {@code null} if unused or not applicable for the store. + * {@code null} if not applicable for the store or transport. */ public final String username; /** - * The password part of the credentials needed to authenticate to the incoming server. + * The password part of the credentials needed to authenticate to the server. * - * {@code null} if unused or not applicable for the store. + * {@code null} if not applicable for the store or transport. */ public final String password; /** - * Creates a new {@code StoreSettings} object. + * Creates a new {@code ServerSettings} object. * * @param type - * see {@link StoreSettings#type} + * see {@link ServerSettings#type} * @param host - * see {@link StoreSettings#host} + * see {@link ServerSettings#host} * @param port - * see {@link StoreSettings#port} + * see {@link ServerSettings#port} * @param connectionSecurity - * see {@link StoreSettings#connectionSecurity} + * see {@link ServerSettings#connectionSecurity} * @param authenticationType - * see {@link StoreSettings#authenticationType} + * see {@link ServerSettings#authenticationType} * @param username - * see {@link StoreSettings#username} + * see {@link ServerSettings#username} * @param password - * see {@link StoreSettings#password} + * see {@link ServerSettings#password} */ - public StoreSettings(String type, String host, int port, + public ServerSettings(String type, String host, int port, ConnectionSecurity connectionSecurity, String authenticationType, String username, String password) { this.type = type; @@ -89,7 +92,7 @@ public class StoreSettings { } /** - * Returns store-specific settings as key/value pair. + * Returns store- or transport-specific settings as key/value pair. * *

Classes that inherit from this one are expected to override this method.

*/ diff --git a/src/com/fsck/k9/mail/Store.java b/src/com/fsck/k9/mail/Store.java index 4ee71ad0b..bb3d1e273 100644 --- a/src/com/fsck/k9/mail/Store.java +++ b/src/com/fsck/k9/mail/Store.java @@ -84,19 +84,19 @@ public abstract class Store { } /** - * Decodes the contents of store-specific URIs and puts them into a {@link StoreSettings} + * Decodes the contents of store-specific URIs and puts them into a {@link ServerSettings} * object. * * @param uri * the store-specific URI to decode * - * @return A {@link StoreSettings} object holding the settings contained in the URI. + * @return A {@link ServerSettings} object holding the settings contained in the URI. * * @see ImapStore#decodeUri(String) * @see Pop3Store#decodeUri(String) * @see WebDavStore#decodeUri(String) */ - public static StoreSettings decodeStoreUri(String uri) { + public static ServerSettings decodeStoreUri(String uri) { if (uri.startsWith("imap")) { return ImapStore.decodeUri(uri); } else if (uri.startsWith("pop3")) { diff --git a/src/com/fsck/k9/mail/store/ImapStore.java b/src/com/fsck/k9/mail/store/ImapStore.java index aa883ee53..d5de81dd7 100644 --- a/src/com/fsck/k9/mail/store/ImapStore.java +++ b/src/com/fsck/k9/mail/store/ImapStore.java @@ -77,7 +77,7 @@ import com.fsck.k9.mail.Part; import com.fsck.k9.mail.PushReceiver; import com.fsck.k9.mail.Pusher; import com.fsck.k9.mail.Store; -import com.fsck.k9.mail.StoreSettings; +import com.fsck.k9.mail.ServerSettings; import com.fsck.k9.mail.filter.CountingOutputStream; import com.fsck.k9.mail.filter.EOLConvertingOutputStream; import com.fsck.k9.mail.filter.FixedLengthInputStream; @@ -223,7 +223,7 @@ public class ImapStore extends Store { * * @see ImapStore#decodeUri(String) */ - private static class ImapStoreSettings extends StoreSettings { + private static class ImapStoreSettings extends ServerSettings { private static final String STORE_TYPE = "IMAP"; private static final String PATH_PREFIX_KEY = "pathPrefix"; diff --git a/src/com/fsck/k9/mail/store/Pop3Store.java b/src/com/fsck/k9/mail/store/Pop3Store.java index c6a275c9f..c356073ba 100644 --- a/src/com/fsck/k9/mail/store/Pop3Store.java +++ b/src/com/fsck/k9/mail/store/Pop3Store.java @@ -48,7 +48,7 @@ public class Pop3Store extends Store { * pop3+ssl://user:password@server:port CONNECTION_SECURITY_SSL_OPTIONAL * */ - public static StoreSettings decodeUri(String uri) { + public static ServerSettings decodeUri(String uri) { String host; int port; ConnectionSecurity connectionSecurity; @@ -101,7 +101,7 @@ public class Pop3Store extends Store { } } - return new StoreSettings(STORE_TYPE, host, port, connectionSecurity, null, username, + return new ServerSettings(STORE_TYPE, host, port, connectionSecurity, null, username, password); } @@ -118,7 +118,7 @@ public class Pop3Store extends Store { public Pop3Store(Account account) throws MessagingException { super(account); - StoreSettings settings; + ServerSettings settings; try { settings = decodeUri(mAccount.getStoreUri()); } catch (IllegalArgumentException e) { diff --git a/src/com/fsck/k9/mail/store/WebDavStore.java b/src/com/fsck/k9/mail/store/WebDavStore.java index 94d446eff..1a092c503 100644 --- a/src/com/fsck/k9/mail/store/WebDavStore.java +++ b/src/com/fsck/k9/mail/store/WebDavStore.java @@ -190,7 +190,7 @@ public class WebDavStore extends Store { * * @see WebDavStore#decodeUri(String) */ - private static class WebDavStoreSettings extends StoreSettings { + private static class WebDavStoreSettings extends ServerSettings { private static final String STORE_TYPE = "WebDAV"; private static final String ALIAS_KEY = "alias"; private static final String PATH_KEY = "path"; diff --git a/src/com/fsck/k9/preferences/StorageExporter.java b/src/com/fsck/k9/preferences/StorageExporter.java index 54bb811fe..9f995e308 100644 --- a/src/com/fsck/k9/preferences/StorageExporter.java +++ b/src/com/fsck/k9/preferences/StorageExporter.java @@ -26,7 +26,7 @@ import com.fsck.k9.K9; import com.fsck.k9.Preferences; import com.fsck.k9.helper.Utility; import com.fsck.k9.mail.Store; -import com.fsck.k9.mail.StoreSettings; +import com.fsck.k9.mail.ServerSettings; import com.fsck.k9.mail.store.LocalStore; @@ -197,7 +197,7 @@ public class StorageExporter { // Write incoming server settings - StoreSettings incoming = Store.decodeStoreUri(account.getStoreUri()); + ServerSettings incoming = Store.decodeStoreUri(account.getStoreUri()); serializer.startTag(null, INCOMING_SERVER_ELEMENT); serializer.attribute(null, TYPE_ATTRIBUTE, incoming.type);