public void addCustomConfiguration (String configId) { addCustomConfiguration(configId, null); }
/** * Updates the custom configurations for this mapper. This should * be called if the custom configurations directory has changed. */ public void updateCustomConfigurations () { File dir = new File(customParmsDir); String res[] = dir.list(new DefaultFilenameFilter(CONFIGFILE_EXT)); clearConfigurations(true); // Only custom configurations if ( res == null ) return; for ( int i=0; i<res.length; i++ ) { addCustomConfiguration(Util.getFilename(res[i], false)); } }
/** * Adds to a given {@link FilterConfigurationMapper} object the custom configuration * defined in the fprm file denoted by a given URL. * @param fcMapper the given {@link FilterConfigurationMapper}. * @param customConfig the URL of a fprm file defining the custom configuration * the filter should be loaded from. The file extension should be .fprm. * The file name should follow the pattern of custom filter configurations, * i.e. contain a filter name like "okf_xmlstream@custom_config.fprm". * @return the configuration identifier or null if the configuration was not added. */ public static String addCustomConfig(FilterConfigurationMapper fcMapper, URL customConfig) { String configId = null; try { String path = customConfig.toURI().getPath(); String root = Util.getDirectoryName(path) + File.separator; configId = Util.getFilename(path, false); fcMapper.setCustomConfigurationsDirectory(root); fcMapper.addCustomConfiguration(configId); fcMapper.updateCustomConfigurations(); } catch (URISyntaxException e) { throw new OkapiIOException(e); } return configId; }