mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
Extracted inner class Store.StoreSettings
This commit is contained in:
parent
6abb5b5850
commit
f4bcb4d923
@ -4,7 +4,7 @@ package com.fsck.k9.mail;
|
||||
* The currently available connection security types.
|
||||
*
|
||||
* <p>
|
||||
* Right now this enum is only used by {@link Store.StoreSettings} and converted to store-specific
|
||||
* 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.
|
||||
* </p>
|
||||
|
@ -13,7 +13,6 @@ import com.fsck.k9.mail.store.StorageManager.StorageProvider;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Store is the access point for an email message store. It's location can be
|
||||
@ -109,108 +108,6 @@ public abstract class Store {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is an abstraction to get rid of the store-specific URIs.
|
||||
*
|
||||
* <p>
|
||||
* Right now it's only used for settings import/export. But the goal is to get rid of
|
||||
* store URIs altogether.
|
||||
* </p>
|
||||
*
|
||||
* @see Account#getStoreUri()
|
||||
*/
|
||||
public static class StoreSettings {
|
||||
/**
|
||||
* Name of the store type (e.g. "IMAP").
|
||||
*/
|
||||
public final String type;
|
||||
|
||||
/**
|
||||
* The host name of the incoming server.
|
||||
*/
|
||||
public final String host;
|
||||
|
||||
/**
|
||||
* The port number of the incoming server.
|
||||
*/
|
||||
public final int port;
|
||||
|
||||
/**
|
||||
* The type of connection security to be used when connecting to the incoming server.
|
||||
*
|
||||
* {@link ConnectionSecurity#NONE} if not applicable for the store.
|
||||
*/
|
||||
public final ConnectionSecurity connectionSecurity;
|
||||
|
||||
/**
|
||||
* The authentication method to use when connecting to the incoming server.
|
||||
*
|
||||
* {@code null} if not applicable for the store.
|
||||
*/
|
||||
public final String authenticationType;
|
||||
|
||||
/**
|
||||
* The username part of the credentials needed to authenticate to the incoming server.
|
||||
*
|
||||
* {@code null} if unused or not applicable for the store.
|
||||
*/
|
||||
public final String username;
|
||||
|
||||
/**
|
||||
* The password part of the credentials needed to authenticate to the incoming server.
|
||||
*
|
||||
* {@code null} if unused or not applicable for the store.
|
||||
*/
|
||||
public final String password;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new {@code StoreSettings} object.
|
||||
*
|
||||
* @param type
|
||||
* see {@link StoreSettings#type}
|
||||
* @param host
|
||||
* see {@link StoreSettings#host}
|
||||
* @param port
|
||||
* see {@link StoreSettings#port}
|
||||
* @param connectionSecurity
|
||||
* see {@link StoreSettings#connectionSecurity}
|
||||
* @param authenticationType
|
||||
* see {@link StoreSettings#authenticationType}
|
||||
* @param username
|
||||
* see {@link StoreSettings#username}
|
||||
* @param password
|
||||
* see {@link StoreSettings#password}
|
||||
*/
|
||||
public StoreSettings(String type, String host, int port,
|
||||
ConnectionSecurity connectionSecurity, String authenticationType, String username,
|
||||
String password) {
|
||||
this.type = type;
|
||||
this.host = host;
|
||||
this.port = port;
|
||||
this.connectionSecurity = connectionSecurity;
|
||||
this.authenticationType = authenticationType;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns store-specific settings as key/value pair.
|
||||
*
|
||||
* <p>Classes that inherit from this one are expected to override this method.</p>
|
||||
*/
|
||||
public Map<String, String> getExtra() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void putIfNotNull(Map<String, String> map, String key, String value) {
|
||||
if (value != null) {
|
||||
map.put(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected final Account mAccount;
|
||||
|
||||
|
||||
|
105
src/com/fsck/k9/mail/StoreSettings.java
Normal file
105
src/com/fsck/k9/mail/StoreSettings.java
Normal file
@ -0,0 +1,105 @@
|
||||
package com.fsck.k9.mail;
|
||||
|
||||
import java.util.Map;
|
||||
import com.fsck.k9.Account;
|
||||
|
||||
/**
|
||||
* This is an abstraction to get rid of the store-specific URIs.
|
||||
*
|
||||
* <p>
|
||||
* Right now it's only used for settings import/export. But the goal is to get rid of
|
||||
* store URIs altogether.
|
||||
* </p>
|
||||
*
|
||||
* @see Account#getStoreUri()
|
||||
*/
|
||||
public class StoreSettings {
|
||||
/**
|
||||
* Name of the store type (e.g. "IMAP").
|
||||
*/
|
||||
public final String type;
|
||||
|
||||
/**
|
||||
* The host name of the incoming server.
|
||||
*/
|
||||
public final String host;
|
||||
|
||||
/**
|
||||
* The port number of the incoming server.
|
||||
*/
|
||||
public final int port;
|
||||
|
||||
/**
|
||||
* The type of connection security to be used when connecting to the incoming server.
|
||||
*
|
||||
* {@link ConnectionSecurity#NONE} if not applicable for the store.
|
||||
*/
|
||||
public final ConnectionSecurity connectionSecurity;
|
||||
|
||||
/**
|
||||
* The authentication method to use when connecting to the incoming server.
|
||||
*
|
||||
* {@code null} if not applicable for the store.
|
||||
*/
|
||||
public final String authenticationType;
|
||||
|
||||
/**
|
||||
* The username part of the credentials needed to authenticate to the incoming server.
|
||||
*
|
||||
* {@code null} if unused or not applicable for the store.
|
||||
*/
|
||||
public final String username;
|
||||
|
||||
/**
|
||||
* The password part of the credentials needed to authenticate to the incoming server.
|
||||
*
|
||||
* {@code null} if unused or not applicable for the store.
|
||||
*/
|
||||
public final String password;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new {@code StoreSettings} object.
|
||||
*
|
||||
* @param type
|
||||
* see {@link StoreSettings#type}
|
||||
* @param host
|
||||
* see {@link StoreSettings#host}
|
||||
* @param port
|
||||
* see {@link StoreSettings#port}
|
||||
* @param connectionSecurity
|
||||
* see {@link StoreSettings#connectionSecurity}
|
||||
* @param authenticationType
|
||||
* see {@link StoreSettings#authenticationType}
|
||||
* @param username
|
||||
* see {@link StoreSettings#username}
|
||||
* @param password
|
||||
* see {@link StoreSettings#password}
|
||||
*/
|
||||
public StoreSettings(String type, String host, int port,
|
||||
ConnectionSecurity connectionSecurity, String authenticationType, String username,
|
||||
String password) {
|
||||
this.type = type;
|
||||
this.host = host;
|
||||
this.port = port;
|
||||
this.connectionSecurity = connectionSecurity;
|
||||
this.authenticationType = authenticationType;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns store-specific settings as key/value pair.
|
||||
*
|
||||
* <p>Classes that inherit from this one are expected to override this method.</p>
|
||||
*/
|
||||
public Map<String, String> getExtra() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void putIfNotNull(Map<String, String> map, String key, String value) {
|
||||
if (value != null) {
|
||||
map.put(key, value);
|
||||
}
|
||||
}
|
||||
}
|
@ -77,6 +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.filter.CountingOutputStream;
|
||||
import com.fsck.k9.mail.filter.EOLConvertingOutputStream;
|
||||
import com.fsck.k9.mail.filter.FixedLengthInputStream;
|
||||
|
@ -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.Store.StoreSettings;
|
||||
import com.fsck.k9.mail.StoreSettings;
|
||||
import com.fsck.k9.mail.store.LocalStore;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user