mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
Renamed class StoreSettings to ServerSettings
This commit is contained in:
parent
f4bcb4d923
commit
bccf0b5546
@ -4,9 +4,10 @@ package com.fsck.k9.mail;
|
||||
* The currently available connection security types.
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
* </p>
|
||||
*/
|
||||
public enum ConnectionSecurity {
|
||||
|
@ -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.
|
||||
*
|
||||
* <p>
|
||||
* 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>
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* <p>Classes that inherit from this one are expected to override this method.</p>
|
||||
*/
|
@ -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")) {
|
||||
|
@ -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";
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class Pop3Store extends Store {
|
||||
* pop3+ssl://user:password@server:port CONNECTION_SECURITY_SSL_OPTIONAL
|
||||
* </pre>
|
||||
*/
|
||||
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) {
|
||||
|
@ -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";
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user