📄 jdavmailstore.java
字号:
/*
* This file is part of the JDAVMail package
* Copyright (C) 2002-2003 Luc Claes. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
* SHALL THE JDAVMail AUTHORS OR THE PROJECT CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307, USA
*
* For questions, suggestions, bug-reports, enhancement-requests etc.
* I may be contacted at:
*
* luc@posisoft.com
*
* The JDAVMail's home page is located at:
*
* http://jdavmail.sourceforge.net
*
*/
package com.posisoft.jdavmail;
import javax.mail.Folder;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Store;
import javax.mail.URLName;
import org.apache.commons.httpclient.URIException;
/** * A JDAVMail Message Store.
* * @author Luc Claes */public class JDAVMailStore extends Store {
private JDAVMailService m_service = null;
/**
* THE Store constructor
*/ public JDAVMailStore(Session session, URLName urlStore) { super(session, ((urlStore == null) || (urlStore.getHost() == null)) ? JDAVMail.DEFAULT_URL : urlStore);
m_service = new JDAVMailService(session, super.url);
} /**
* Establish the connection.
*
* @return true iff the connection is established, false on authentication failure
* @exception MessagingException on connection failure
*/ protected boolean protocolConnect(String strHost, int nPort, String strUser, String strPassword)
throws MessagingException {
return m_service.protocolConnect(strHost, nPort, strUser, strPassword);
}
/** */ public boolean isConnected() {
return m_service.isConnected(); }
/**
*/ public synchronized void close() throws MessagingException { super.close();
m_service.close();
}
/**
*/ public Folder getDefaultFolder() throws MessagingException { return m_service.getDefaultFolder(this); } /** */ public Folder getFolder(String strName) throws MessagingException { return new JDAVMailFolder(this, strName); }
/**
*/ public Folder getFolder(URLName url) throws MessagingException {
try { return new JDAVMailFolder(this, url);
} catch (URIException e) {
throw new MessagingException("", e);
}
}
/**
*/
public Folder[] getPersonalNamespaces() {
FolderProxy[] fps = m_service.getRootFolderProxy().getChildren();
JDAVMailFolder[] folders = new JDAVMailFolder[fps.length];
for (int i = 0; i < fps.length; i++) {
folders[i] = new JDAVMailFolder(this, fps[i]);
}
return folders;
}
/**
*/ protected void finalize() throws Throwable { super.finalize();
close(); }
/**
*/
protected JDAVMailService _getService(){
return m_service;
}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -