com.fsck.k9.mail.Store Source Code | www.androidadb.com

…Souce Code of com.fsck.k9.mail.

package com.fsck.k9.mail;

import android.app.Application;

import android.content.Context;

import com.fsck.k9.Account;

import com.fsck.k9.mail.store.ImapStore;

import com.fsck.k9.mail.store.LocalStore;

import com.fsck.k9.mail.store.Pop3Store;

import com.fsck.k9.mail.store.WebDavStore;

import com.fsck.k9.mail.store.StorageManager.StorageProvider;

import java.util.HashMap;

import java.util.List;

/**

* Store is the access point for an email message store. It’s location can be

* local or remote and no specific protocol is defined. Store is intended to

* loosely model in combination the JavaMail classes javax.mail.Store and

* javax.mail.Folder along with some additional functionality to improve

* performance on mobile devices. Implementations of this class should focus on

* making as few network connections as possible.

*/

public abstract class Store {

protected static final int SOCKET_CONNECT_TIMEOUT = 30000;

protected static final int SOCKET_READ_TIMEOUT = 60000;

/**

* Remote stores indexed by Uri.

*/

private static HashMap mStores = new HashMap();

/**

* Local stores indexed by UUid because the Uri may change due to migration to/from SD-card.

*/

private static HashMap mLocalStores = new HashMap();

protected final Account mAccount;

protected Store(Account account) {

mAccount = account;

}

/**

* Get an instance of a remote mail store.

*/

public synchronized static Store getRemoteInstance(Account account) throws MessagingException {

String uri = account.getStoreUri();

if (uri.startsWith(“local”)) {

throw new RuntimeException(“Asked to get non-local Store object but given LocalStore URI”);

}

Store store = mStores.get(uri);

if (store == null) {

if (uri.startsWith(“imap”)) {

store = new ImapStore(account);

} else if (uri.startsWith(“pop3”)) {

store = new Pop3Store(account);

} else if (uri.startsWith(“webdav”)) {

store = new WebDavStore(account);

}

if (store != null) {

mStores.put(uri, store);

}

}

if (store == null) {

throw new MessagingException(“Unable to locate an applicable Store for ” + uri);

}

return store;

}

/**

* Get an instance of a local mail store.

* @throws UnavailableStorageException if not {@link StorageProvider#isReady(Context)}

*/

public synchronized static LocalStore getLocalInstance(Account account, Application application) throws MessagingException {

Store store = mLocalStores.get(account.getUuid());

if (store == null) {

store = new LocalStore(account, application);

mLocalStores.put(account.getUuid(), store);

}

return (LocalStore) store;

}

public abstract Folder getFolder(String name);

public abstract List getPersonalNamespaces(boolean forceListAll) throws MessagingException;

public abstract void checkSettings() throws MessagingException;

public boolean isCopyCapable() {

return false;

}

public boolean isMoveCapable() {

return false;

}

public boolean isPushCapable() {

return false;

}

public boolean isSendCapable() {

return false;

}

public boolean isExpungeCapable() {

return false;

}

public void sendMessages(Message[] messages) throws MessagingException {

}

public Pusher getPusher(PushReceiver receiver) {

return null;

}

public Account getAccount() {

return mAccount;

}

}

Related Class of com.fsck.k9.mail.Store

Copyright © 2011 www.androidadb.com. All rights reserved. All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc. Contact . See also:

|

|

|

Read More Post

STAY CONNECTED

Most Popular

Why Serviced Apartments Are the Perfect Choice for Long-Term Stays in Singapore – Everything You Need to Know
17 Dec

Why Serviced Apartments Are the Perfect Choice for Long-Term Stays in Singapore – Everything You Need to Know

If you’re heading to Singapore for a few weeks or many months, maybe for work or study or just to

Manifesting Your Dream Career: Finding Your Passion And Purpose
01 Aug

Manifesting Your Dream Career: Finding Your Passion And Purpose

Are you passionate about finding your dream career? Manifesting can help you align your career with your passions and purpose.

Revolutionizing Your Ride: Expert Auto Service At Carolina Auto Service
27 Feb

Revolutionizing Your Ride: Expert Auto Service At Carolina Auto Service

Finding a reliable auto service provider is paramount in the bustling world of vehicle maintenance and repair. That's where Carolina

Floratam: The Robust Grass Solution From Council Growers SOD
25 Jan

Floratam: The Robust Grass Solution From Council Growers SOD

Floratam grass, a popular St. Augustine variety, has become a go-to choice for homeowners and landscapers seeking a lush, durable

Carolina Mobile Autoservice: Your Go-To For Expert Brake Service Repair
25 Jan

Carolina Mobile Autoservice: Your Go-To For Expert Brake Service Repair

For vehicle owners, the braking system is among the most critical components for safety and performance. Carolina Mobile Autoservice, a

Safeguarding Your Property: Expert Water Damage Services By MBC Capital
24 Jan

Safeguarding Your Property: Expert Water Damage Services By MBC Capital

Water damage can significantly impact homes and businesses, often leaving a trail of destruction and disruption in its wake. Understanding