1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 19:52:17 -05:00

Renamed class StoreSettings to ServerSettings

This commit is contained in:
cketti 2011-06-07 16:09:15 +02:00
parent f4bcb4d923
commit bccf0b5546
7 changed files with 42 additions and 38 deletions

View File

@ -4,9 +4,10 @@ package com.fsck.k9.mail;
* The currently available connection security types. * The currently available connection security types.
* *
* <p> * <p>
* Right now this enum is only used by {@link StoreSettings} and converted to store-specific * Right now this enum is only used by {@link ServerSettings} and converted to store- or
* constants in the different Store implementations. In the future we probably want to change this * transport-specific constants in the different {@link Store} and {@link Transport}
* and use {@code ConnectionSecurity} exclusively. * implementations. In the future we probably want to change this and use
* {@code ConnectionSecurity} exclusively.
* </p> * </p>
*/ */
public enum ConnectionSecurity { public enum ConnectionSecurity {

View File

@ -4,79 +4,82 @@ import java.util.Map;
import com.fsck.k9.Account; 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.
* *
* <p> * <p>
* Right now it's only used for settings import/export. But the goal is to get rid of * 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.
* </p> * </p>
* *
* @see Account#getStoreUri() * @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; 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; public final String host;
/** /**
* The port number of the incoming server. * The port number of the server.
*/ */
public final int port; 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; 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; 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; 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; public final String password;
/** /**
* Creates a new {@code StoreSettings} object. * Creates a new {@code ServerSettings} object.
* *
* @param type * @param type
* see {@link StoreSettings#type} * see {@link ServerSettings#type}
* @param host * @param host
* see {@link StoreSettings#host} * see {@link ServerSettings#host}
* @param port * @param port
* see {@link StoreSettings#port} * see {@link ServerSettings#port}
* @param connectionSecurity * @param connectionSecurity
* see {@link StoreSettings#connectionSecurity} * see {@link ServerSettings#connectionSecurity}
* @param authenticationType * @param authenticationType
* see {@link StoreSettings#authenticationType} * see {@link ServerSettings#authenticationType}
* @param username * @param username
* see {@link StoreSettings#username} * see {@link ServerSettings#username}
* @param password * @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, ConnectionSecurity connectionSecurity, String authenticationType, String username,
String password) { String password) {
this.type = type; 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.
* *
* <p>Classes that inherit from this one are expected to override this method.</p> * <p>Classes that inherit from this one are expected to override this method.</p>
*/ */

View File

@ -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. * object.
* *
* @param uri * @param uri
* the store-specific URI to decode * 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 ImapStore#decodeUri(String)
* @see Pop3Store#decodeUri(String) * @see Pop3Store#decodeUri(String)
* @see WebDavStore#decodeUri(String) * @see WebDavStore#decodeUri(String)
*/ */
public static StoreSettings decodeStoreUri(String uri) { public static ServerSettings decodeStoreUri(String uri) {
if (uri.startsWith("imap")) { if (uri.startsWith("imap")) {
return ImapStore.decodeUri(uri); return ImapStore.decodeUri(uri);
} else if (uri.startsWith("pop3")) { } else if (uri.startsWith("pop3")) {

View File

@ -77,7 +77,7 @@ import com.fsck.k9.mail.Part;
import com.fsck.k9.mail.PushReceiver; import com.fsck.k9.mail.PushReceiver;
import com.fsck.k9.mail.Pusher; import com.fsck.k9.mail.Pusher;
import com.fsck.k9.mail.Store; 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.CountingOutputStream;
import com.fsck.k9.mail.filter.EOLConvertingOutputStream; import com.fsck.k9.mail.filter.EOLConvertingOutputStream;
import com.fsck.k9.mail.filter.FixedLengthInputStream; import com.fsck.k9.mail.filter.FixedLengthInputStream;
@ -223,7 +223,7 @@ public class ImapStore extends Store {
* *
* @see ImapStore#decodeUri(String) * @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 STORE_TYPE = "IMAP";
private static final String PATH_PREFIX_KEY = "pathPrefix"; private static final String PATH_PREFIX_KEY = "pathPrefix";

View File

@ -48,7 +48,7 @@ public class Pop3Store extends Store {
* pop3+ssl://user:password@server:port CONNECTION_SECURITY_SSL_OPTIONAL * pop3+ssl://user:password@server:port CONNECTION_SECURITY_SSL_OPTIONAL
* </pre> * </pre>
*/ */
public static StoreSettings decodeUri(String uri) { public static ServerSettings decodeUri(String uri) {
String host; String host;
int port; int port;
ConnectionSecurity connectionSecurity; 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); password);
} }
@ -118,7 +118,7 @@ public class Pop3Store extends Store {
public Pop3Store(Account account) throws MessagingException { public Pop3Store(Account account) throws MessagingException {
super(account); super(account);
StoreSettings settings; ServerSettings settings;
try { try {
settings = decodeUri(mAccount.getStoreUri()); settings = decodeUri(mAccount.getStoreUri());
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {

View File

@ -190,7 +190,7 @@ public class WebDavStore extends Store {
* *
* @see WebDavStore#decodeUri(String) * @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 STORE_TYPE = "WebDAV";
private static final String ALIAS_KEY = "alias"; private static final String ALIAS_KEY = "alias";
private static final String PATH_KEY = "path"; private static final String PATH_KEY = "path";

View File

@ -26,7 +26,7 @@ import com.fsck.k9.K9;
import com.fsck.k9.Preferences; import com.fsck.k9.Preferences;
import com.fsck.k9.helper.Utility; import com.fsck.k9.helper.Utility;
import com.fsck.k9.mail.Store; 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; import com.fsck.k9.mail.store.LocalStore;
@ -197,7 +197,7 @@ public class StorageExporter {
// Write incoming server settings // Write incoming server settings
StoreSettings incoming = Store.decodeStoreUri(account.getStoreUri()); ServerSettings incoming = Store.decodeStoreUri(account.getStoreUri());
serializer.startTag(null, INCOMING_SERVER_ELEMENT); serializer.startTag(null, INCOMING_SERVER_ELEMENT);
serializer.attribute(null, TYPE_ATTRIBUTE, incoming.type); serializer.attribute(null, TYPE_ATTRIBUTE, incoming.type);