📄 abstractstore.java
字号:
/*
* SSL-Explorer
*
* Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
* This program 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package com.sslexplorer.vfs.webdav;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.sslexplorer.security.SessionInfo;
/**
* @author Brett Smith <brett@3sp.com>
*/
public abstract class AbstractStore implements DAVStore {
final static Log log = LogFactory.getLog(AbstractStore.class);
private DAVRepository repository;
private String name;
private String charset;
/**
*
*/
public AbstractStore(String name, String charset) {
super();
this.name = name;
this.charset = charset;
}
public boolean willHandle(String scheme) {
return scheme.equals(getName());
}
public boolean isFireEvents() {
return true;
}
public String getEncoding() {
return charset;
}
/*
* (non-Javadoc)
*
* @see org.betaversion.webdav.DAVStore#getName()
*/
public String getName() {
return name;
}
public void init(DAVRepository repository) {
this.repository = repository;
}
public DAVRepository getRepository() {
return repository;
}
public DAVResource getStoreResource(DAVTransaction transaction) throws DAVException {
try {
return new AbstractStoreResource(getName());
} catch (URISyntaxException e) {
throw new DAVException(DAVStatus.SC_INTERNAL_SERVER_ERROR, "Failed to create store resource.", e);
}
}
public abstract DAVMount getMountFromString(String mountName, SessionInfo session) throws DAVException;
class AbstractStoreResource extends AbstractDAVResource {
public AbstractStoreResource(String name) throws URISyntaxException {
super(new URI(name), true, name, null);
}
public Iterator getChildren() throws IOException, DAVAuthenticationRequiredException {
List l = new ArrayList();
try {
for(Iterator i = getMountIterator(getTransaction()); i.hasNext(); ) {
l.add(((DAVMount)i.next()).getResource("", getTransaction()));
}
} catch(DAVAuthenticationRequiredException dare) {
} catch (Exception e) {
log.error("Failed to get store resources.", e);
}
return l.iterator();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -