| 1 | |
package org.webslinger.commons.vfs.virtual; |
| 2 | |
|
| 3 | |
import org.apache.commons.vfs.FileSystemConfigBuilder; |
| 4 | |
import org.apache.commons.vfs.FileSystemOptions; |
| 5 | |
|
| 6 | |
import org.webslinger.commons.vfs.handlers.HandlerFactory; |
| 7 | |
import org.webslinger.commons.vfs.handlers.cow.COWStorageHandler; |
| 8 | |
|
| 9 | |
public class VirtualConfigBuilder extends FileSystemConfigBuilder { |
| 10 | 1 | private static final VirtualConfigBuilder builder = new VirtualConfigBuilder(); |
| 11 | |
|
| 12 | 1 | private static final String STORAGE_HANDLER_FACTORY_KEY = VirtualConfigBuilder.class.getName() + ".StorageHandlerFactory"; |
| 13 | |
|
| 14 | |
public static VirtualConfigBuilder getInstance() { |
| 15 | 138 | return builder; |
| 16 | |
} |
| 17 | |
|
| 18 | 1 | private VirtualConfigBuilder() { |
| 19 | 1 | } |
| 20 | |
|
| 21 | |
protected Class getConfigClass() { |
| 22 | 138 | return VirtualFileSystem.class; |
| 23 | |
} |
| 24 | |
|
| 25 | |
public void setStorageHandlerFactory(FileSystemOptions options, HandlerFactory<COWStorageHandler, VirtualFileSystem> handler) { |
| 26 | 32 | setParam(options, STORAGE_HANDLER_FACTORY_KEY, handler); |
| 27 | 32 | } |
| 28 | |
|
| 29 | |
public HandlerFactory<COWStorageHandler, VirtualFileSystem> getStorageHandlerFactory(FileSystemOptions options) { |
| 30 | 106 | return (HandlerFactory<COWStorageHandler, VirtualFileSystem>) getParam(options, STORAGE_HANDLER_FACTORY_KEY); |
| 31 | |
} |
| 32 | |
} |