- Timestamp:
- 2006-03-16T14:42:37+13:00 (18 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer/cdm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/Plugin.java
r11282 r11378 171 171 172 172 173 /** Checks whether this plugin instance will process the specified file (given its block_exp). */ 174 public boolean doesBlockFile(File file) 175 { 176 // Check the filename against the plugin's block_exp value 177 ArrayList arguments = getArguments(true, true); 178 for (int i = 0; i < arguments.size(); i++) { 179 Argument argument = (Argument) arguments.get(i); 180 if (argument.getName().equals("block_exp")) { 181 // Try the assigned value first, for when the user has manually set the value 182 String regular_expression = argument.getValue(); 183 if (regular_expression == null || regular_expression.equals("")) { 184 // Not set, so use the default value 185 regular_expression = argument.getDefaultValue(); 186 if (regular_expression.equals("")) { 187 continue; 188 } 189 } 190 191 // The $ at the end doesn't seem to work in Java, so need to add ".*" at the start 192 if (regular_expression.startsWith("(?i)")) { 193 // Don't mess up case-insensitive matching though 194 regular_expression = "(?i)" + ".*" + regular_expression.substring("(?i)".length()); 195 } 196 else { 197 regular_expression = ".*" + regular_expression; 198 } 199 200 // If the filename matches the regular expression, this plugin will deal with the file in some way 201 if (file.getName().matches(regular_expression)) { 202 return true; 203 } 204 } 205 } 206 207 // This plugin will (probably) not deal with the specified file 208 return false; 209 } 210 211 173 212 /** Checks whether this plugin instance will process the specified file (given its process_exp). */ 174 213 public boolean doesProcessFile(File file) -
trunk/gli/src/org/greenstone/gatherer/cdm/PluginManager.java
r11130 r11378 140 140 for (int i = 0; i < super.getSize(); i++) { 141 141 Plugin assigned_plugin = (Plugin) getElementAt(i); 142 if (assigned_plugin.isSeparator() == false && assigned_plugin.doesProcessFile(file) == true) {142 if (assigned_plugin.isSeparator() == false && (assigned_plugin.doesProcessFile(file) == true || assigned_plugin.doesBlockFile(file) == true)) { 143 143 // This file will be processed by an assigned plugin, so no suggestion is necessary 144 144 DebugStream.println("Processed by assigned plugin: " + assigned_plugin);
Note:
See TracChangeset
for help on using the changeset viewer.