📄 davstoremanager.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.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import com.sslexplorer.vfs.store.apps.ApplicationStore;
import com.sslexplorer.vfs.store.cifs.CIFSStore;
import com.sslexplorer.vfs.store.file.FileStore;
import com.sslexplorer.vfs.store.ftp.FTPStore;
/**
* @author Brett Smith <brett@3sp.com>
*/
public class DAVStoreManager {
private List storeClasses;
private static DAVStoreManager instance;
/**
*
*/
private DAVStoreManager() {
storeClasses = new ArrayList();
}
public static DAVStoreManager getInstance() {
if(instance == null) {
instance = new DAVStoreManager();
instance.registerStore(FileStore.class);
instance.registerStore(FTPStore.class);
instance.registerStore(CIFSStore.class);
instance.registerStore(ApplicationStore.class);
}
return instance;
}
public void registerStore(Class storeClass) {
storeClasses.add(storeClass);
}
public Map createStores(DAVRepository repository) throws InstantiationException, IllegalAccessException {
Map stores = new TreeMap();
Iterator i = storeClasses.iterator();
while (i.hasNext()){
Class storeClass = (Class)i.next() ;
DAVStore store = (DAVStore)(storeClass).newInstance();
store.init(repository);
stores.put(store.getName(), store);
}
return stores;
}
public void deregisterStore(Class clazz) {
storeClasses.remove(clazz);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -