- Timestamp:
- 2005-07-13T11:12:11+12:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/CollectionDesignManager.java
r9640 r10237 50 50 /** This listener listens for any event on any of the components in any of the sub-views, and marks the collection as needing saving if any change occurs. */ 51 51 static public CDMChangeListener change_listener; 52 /** These listeners listen to changes in the Design mode so as to allow incremental building */ 53 static public DesignChangeListener all_change_listener; 54 static public DesignChangeListener buildcol_change_listener; 55 static public DesignChangeListener collect_cfg_change_listener; 52 56 /** A list of classifiers to use at build time. */ 53 57 static public ClassifierManager classifier_manager; … … 78 82 /** The text translation manager. */ 79 83 static public TranslationView translation_view; 84 /** These mark what needs to happen when building a collection where ONLY design options have been changed. 85 The build requirements of the higher numbers must include doing everything from the lower numbers. */ 86 static final public int ALL = 3; 87 static final public int BUILDCOL = 2; 88 static final public int UPDATE_COLLECT_CFG = 1; 89 static final public int NOTHING = 0; 90 static private int rebuildTypeRequired = NOTHING; //Rebuild type required if only design options have changed 91 static protected boolean update_collect_cfg_required = false; 92 80 93 /** Constructor. Loads a certain collection configuration file, which is parsed into a DOM. This model is then registered with the command information managers, each of whom knows how to, and provides controls to, alter certain commands. 81 94 * @param collect_config_file the File representing a collection configuration file either in its text (G2) or xml (G3) form … … 84 97 DebugStream.println("Initializaing CollectionDesignModule."); 85 98 change_listener = new CDMChangeListener(); 99 all_change_listener = new DesignChangeListener(ALL); 100 buildcol_change_listener = new DesignChangeListener(BUILDCOL); 101 collect_cfg_change_listener = new DesignChangeListener(UPDATE_COLLECT_CFG); 86 102 // Parse the collection configuration 87 103 collect_config = new CollectionConfiguration(collect_config_file); … … 199 215 */ 200 216 public void save() { 217 System.err.println("Config file saved. The level of processing needed is: " + CollectionDesignManager.getRebuildTypeRequired()); //debug 201 218 // Release collection as necessary 202 219 String collection_name = Gatherer.c_man.getCollection().getName(); 203 220 boolean collection_released = false; 204 boolean formats_changed = format_manager.formatsChanged(); 205 206 if (formats_changed && Gatherer.c_man.built() && LocalLibraryServer.isRunning() == true) { 221 222 if (update_collect_cfg_required && Gatherer.c_man.built() && LocalLibraryServer.isRunning() == true) { 207 223 // Release the collection 208 224 LocalLibraryServer.releaseCollection(collection_name); … … 213 229 collect_config.save(); 214 230 215 if (Gatherer.isGsdlRemote) { 216 if (formats_changed && Gatherer.c_man.built()) { 217 // upload etc/collect.cfg to server to reflect changes 218 Utility.zipup(Gatherer.getCollectDirectoryPath(), collection_name, Utility.CONFIG_FILE, null, "", ""); 219 GathererApplet.upload_url_zip(collection_name, "etc", "", null); 220 } 221 } 222 223 // Readd collection 231 if (update_collect_cfg_required && Gatherer.c_man.built() && Gatherer.isGsdlRemote) { 232 //If the GLI is running as an applet, and Format Features or Cross-Collection Searching have changed, 233 //upload etc/collect.cfg to the server to immediately reflect these changes. 234 Utility.zipup(Gatherer.getCollectDirectoryPath(), collection_name, Utility.CONFIG_FILE, null, "", ""); 235 GathererApplet.upload_url_zip(collection_name, "etc", "", null); 236 } 237 238 // Read collection 224 239 if (collection_released) { 225 240 // Now re-add collection to server to force format commands to be processed … … 227 242 } 228 243 229 if ( formats_changed) {244 if (update_collect_cfg_required) { 230 245 // Unset formats changed 231 format_manager.setFormatsChanged(false);246 update_collect_cfg_required = false; 232 247 } 233 248 } … … 263 278 } 264 279 265 280 public static int getRebuildTypeRequired() { 281 return rebuildTypeRequired; 282 } 283 public static void resetRebuildTypeRequired() { 284 setRebuildTypeRequired(NOTHING); 285 } 286 public static void setRebuildTypeRequired(int number) { 287 rebuildTypeRequired = number; 288 } 289 290 /** 291 * What exactly does this do? 292 */ 266 293 private class CDMChangeListener 267 294 implements ActionListener, DocumentListener { 268 295 296 /** Gives notification that an event has happened */ 269 297 public void actionPerformed(ActionEvent event) { 270 298 Gatherer.c_man.getCollection().setSaved(false);
Note:
See TracChangeset
for help on using the changeset viewer.