本文整理汇总了Java中net.sf.okapi.common.filters.FilterConfigurationMapper类的典型用法代码示例。如果您正苦于以下问题:Java FilterConfigurationMapper类的具体用法?Java FilterConfigurationMapper怎么用?Java FilterConfigurationMapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FilterConfigurationMapper类属于net.sf.okapi.common.filters包,在下文中一共展示了FilterConfigurationMapper类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getConfiguredFilterConfigurationMapper
import net.sf.okapi.common.filters.FilterConfigurationMapper; //导入依赖的package包/类
/**
* @return A {@link FilterConfigurationMapper}, which has been configured with the default mappings
*/
public IFilterConfigurationMapper getConfiguredFilterConfigurationMapper() {
IFilterConfigurationMapper mapper = new FilterConfigurationMapper();
// Adding default filter mappings
DefaultFilters.setMappings(mapper, false, true);
// Adding custom filters mappings
mapper.addConfigurations(CSVFilter.class.getName());
mapper.addConfigurations(POFilter.class.getName());
mapper.addConfigurations(XMLFilter.class.getName());
mapper.addConfigurations(MacStringsFilter.class.getName());
return mapper;
}
示例2: getFilterMapper
import net.sf.okapi.common.filters.FilterConfigurationMapper; //导入依赖的package包/类
protected FilterConfigurationMapper getFilterMapper(String filterConfigPath,
PluginsManager plManager) {
// Initialize filter configurations
FilterConfigurationMapper fcMapper = new FilterConfigurationMapper();
DefaultFilters.setMappings(fcMapper, false, true);
if (plManager != null) {
fcMapper.addFromPlugins(plManager);
}
if (filterConfigPath != null) {
System.out.println("Loading custom filter configurations from " +
filterConfigPath);
fcMapper.setCustomConfigurationsDirectory(filterConfigPath);
fcMapper.updateCustomConfigurations();
}
return fcMapper;
}
示例3: loadFromSettings
import net.sf.okapi.common.filters.FilterConfigurationMapper; //导入依赖的package包/类
/**
* Load from an rnb file.
* @throws Exception
*/
void loadFromSettings(String rnbPath, PluginsManager plManager) {
LanguageManager lm = new LanguageManager(); // ???
Project project = new Project(lm);
try {
project.load(rnbPath);
}
catch (Exception e) {
throw new BuildException("Couldn't load project from " + rnbPath, e);
}
// Pipeline
FilterConfigurationMapper fcMapper = getFilterMapper(filterConfigPath, plManager);
PipelineWrapper pipelineWrapper = getPipelineWrapper(getProject().getBaseDir(), fcMapper, plManager);
String pln = project.getUtilityParameters("currentProjectPipeline");
pipelineWrapper.loadFromStringStorageOrReset(pln);
// Allow <filterMapping> elements to override the contents of the settings.
// BatchConfiguration.exportConfiguration() always takes the first configuration
// it finds for a given extension, so we just list the overrides first.
List<Input> inputFiles = processFilterMappings(fcMapper);
inputFiles.addAll(project.getList(0));
BatchConfiguration bconfig = new BatchConfiguration();
System.out.println("Writing batch configuration to " + bconfPath);
bconfig.exportConfiguration(bconfPath, pipelineWrapper, fcMapper, inputFiles);
}
示例4: processFilterMappings
import net.sf.okapi.common.filters.FilterConfigurationMapper; //导入依赖的package包/类
List<Input> processFilterMappings(FilterConfigurationMapper fcMapper) {
// Convert filter mappings into dummy input files so the extension
// map is generated. Also add any custom configurations while we go.
List<Input> inputFiles = new ArrayList<Input>();
for (FilterMapping fm : filterMappings) {
Input input = TaskUtil.createInput(fm.extension, fm.filterConfig);
inputFiles.add(input);
System.out.println("Added filter mapping " + fm.extension + " --> " + fm.filterConfig);
if (fcMapper.getConfiguration(input.filterConfigId) == null) {
System.out.println("Loading " + input.filterConfigId);
fcMapper.addCustomConfiguration(input.filterConfigId);
if (fcMapper.getConfiguration(input.filterConfigId) == null) {
throw new BuildException("Could not load filter configuration '"
+ input.filterConfigId + "'");
}
}
}
return inputFiles;
}
示例5: getPipelineWrapper
import net.sf.okapi.common.filters.FilterConfigurationMapper; //导入依赖的package包/类
protected PipelineWrapper getPipelineWrapper(File baseDir,
FilterConfigurationMapper fcMapper, PluginsManager plManager) {
PipelineWrapper pipelineWrapper = new PipelineWrapper(fcMapper, baseDir.getPath(),
plManager, baseDir.getPath(), baseDir.getPath(),
null, null, null);
pipelineWrapper.addFromPlugins(plManager);
return pipelineWrapper;
}
示例6: getFilterMapper
import net.sf.okapi.common.filters.FilterConfigurationMapper; //导入依赖的package包/类
private FilterConfigurationMapper getFilterMapper() {
if (fcMapper == null) {
String filterConfigDirPath = filterConfigDir == null ? DEFAULT_RESOURCES_DIR
: new File(getProject().getBaseDir(), filterConfigDir).getAbsolutePath();
fcMapper = super.getFilterMapper(filterConfigDirPath, null);
}
return fcMapper;
}
示例7: executeWithOkapiClassloader
import net.sf.okapi.common.filters.FilterConfigurationMapper; //导入依赖的package包/类
@Override
void executeWithOkapiClassloader() {
PluginsManager plManager = new PluginsManager();
// HACK: We have to initialize the PluginsManager -somewhere-, because otherwise
// the PipelineWrapper constructor will crash. This is because the PluginsManager
// lazily initializes its internal lists, rather than allowing for empty lists.
plManager.discover(getProject().getBaseDir(), true);
FilterConfigurationMapper fcMapper = new FilterConfigurationMapper();
PipelineWrapper pipelineWrapper = getPipelineWrapper(getProject().getBaseDir(),
fcMapper, plManager);
System.out.println("Writing " + bconfPath + " to " + directoryPath);
new BatchConfiguration().installConfiguration(bconfPath, directoryPath,
pipelineWrapper);
}
示例8: loadFromPipeline
import net.sf.okapi.common.filters.FilterConfigurationMapper; //导入依赖的package包/类
void loadFromPipeline(String plnPath, PluginsManager plManager) {
// Initialize things and load the pipeline. This will produce
// a warning if the pipeline references unavailable steps.
// However, it will not break the build. (Okapi gives me no
// easy way to intercept this problem.)
FilterConfigurationMapper fcMapper = getFilterMapper(filterConfigPath, plManager);
PipelineWrapper pipelineWrapper = getPipelineWrapper(getProject().getBaseDir(),
fcMapper, plManager);
pipelineWrapper.load(plnPath);
List<Input> inputFiles = processFilterMappings(fcMapper);
BatchConfiguration bconfig = new BatchConfiguration();
System.out.println("Writing batch configuration to " + bconfPath);
bconfig.exportConfiguration(bconfPath, pipelineWrapper, fcMapper, inputFiles);
}
示例9: executeWithOkapiClassloader
import net.sf.okapi.common.filters.FilterConfigurationMapper; //导入依赖的package包/类
@Override
void executeWithOkapiClassloader() {
PluginsManager plManager = null;
try {
FilterConfigurationMapper fcMapper = getFilterMapper(filterConfigPath,
null);
tempPluginsDir = Files.createTempDirectory("plugins");
if (plugins != null) {
plManager = TaskUtil.createPluginsManager(tempPluginsDir, plugins.filesets);
}
else {
plManager = new PluginsManager();
}
PipelineWrapper pipelineWrapper = getPipelineWrapper(getProject()
.getBaseDir(), fcMapper, plManager);
pipelineWrapper.load(plnPath);
Project prj = createProject(pipelineWrapper);
for (FileSet fs : filesets) {
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
for (String s : ds.getIncludedFiles()) {
addFileToProject(prj, new File(ds.getBasedir(), s));
}
}
pipelineWrapper.execute(prj);
}
catch (IOException e) {
throw new BuildException("Failed to initialize plugins", e);
}
finally {
TaskUtil.deleteDirectory(tempPluginsDir);
}
}
示例10: getPipelineWrapper
import net.sf.okapi.common.filters.FilterConfigurationMapper; //导入依赖的package包/类
@Override
protected PipelineWrapper getPipelineWrapper(File baseDir,
FilterConfigurationMapper fcMapper, PluginsManager plManager) {
ExecutionContext context = new ExecutionContext();
context.setApplicationName("Longhorn");
context.setIsNoPrompt(true);
String outputRoot = getProjectOutputPath(baseDir);
PipelineWrapper pipelineWrapper = new PipelineWrapper(fcMapper,
baseDir.getPath(), plManager, outputRoot,
baseDir.getPath(), outputRoot, null, context);
pipelineWrapper.addFromPlugins(plManager);
return pipelineWrapper;
}
示例11: Pipeline
import net.sf.okapi.common.filters.FilterConfigurationMapper; //导入依赖的package包/类
public Pipeline() {
fcMapper = new FilterConfigurationMapper();
fcMapper.addConfigurations(Pipeline.CFG_CLASS);
}