| 1 | |
package org.webslinger.commons.vfs.flat; |
| 2 | |
|
| 3 | |
import org.apache.commons.vfs.FileSystemConfigBuilder; |
| 4 | |
import org.apache.commons.vfs.FileSystemOptions; |
| 5 | |
|
| 6 | |
import org.webslinger.commons.vfs.handlers.ExclusionHandler; |
| 7 | |
import org.webslinger.commons.vfs.handlers.HandlerFactory; |
| 8 | |
import org.webslinger.commons.vfs.handlers.cow.COWStorageHandler; |
| 9 | |
import org.webslinger.commons.vfs.handlers.attributes.AttributeMapperHandler; |
| 10 | |
|
| 11 | |
public class FlatConfigBuilder extends FileSystemConfigBuilder { |
| 12 | 1 | private static final FlatConfigBuilder builder = new FlatConfigBuilder(); |
| 13 | |
|
| 14 | 1 | private static final String ATTRIBUTE_HANDLER_FACTORY_KEY = FlatConfigBuilder.class.getName() + ".AttributeHandlerFactory"; |
| 15 | 1 | private static final String EXCLUSION_HANDLER_FACTORY_KEY = FlatConfigBuilder.class.getName() + ".ExclusionHandlerFactory"; |
| 16 | |
|
| 17 | |
public static FlatConfigBuilder getInstance() { |
| 18 | 85 | return builder; |
| 19 | |
} |
| 20 | |
|
| 21 | 1 | private FlatConfigBuilder() { |
| 22 | 1 | } |
| 23 | |
|
| 24 | |
protected Class getConfigClass() { |
| 25 | 85 | return FlatFileSystem.class; |
| 26 | |
} |
| 27 | |
|
| 28 | |
public void setAttributeMapperHandlerFactory(FileSystemOptions options, HandlerFactory<AttributeMapperHandler, FlatFileSystem> handler) { |
| 29 | 0 | setParam(options, ATTRIBUTE_HANDLER_FACTORY_KEY, handler); |
| 30 | 0 | } |
| 31 | |
|
| 32 | |
public HandlerFactory<AttributeMapperHandler, FlatFileSystem> getAttributeMapperHandlerFactory(FileSystemOptions options) { |
| 33 | 32 | return (HandlerFactory<AttributeMapperHandler, FlatFileSystem>) getParam(options, ATTRIBUTE_HANDLER_FACTORY_KEY); |
| 34 | |
} |
| 35 | |
|
| 36 | |
public void setExclusionHandlerFactory(FileSystemOptions options, HandlerFactory<ExclusionHandler, FlatFileSystem> handler) { |
| 37 | 26 | setParam(options, EXCLUSION_HANDLER_FACTORY_KEY, handler); |
| 38 | 26 | } |
| 39 | |
|
| 40 | |
public HandlerFactory<ExclusionHandler, FlatFileSystem> getExclusionHandlerFactory(FileSystemOptions options) { |
| 41 | 27 | return (HandlerFactory<ExclusionHandler, FlatFileSystem>) getParam(options, EXCLUSION_HANDLER_FACTORY_KEY); |
| 42 | |
} |
| 43 | |
} |