Changeset 5571 for trunk/gli/src/org/greenstone/gatherer/collection
- Timestamp:
- 2003-10-03T17:09:38+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java
r5564 r5571 45 45 import org.greenstone.gatherer.Dictionary; 46 46 import org.greenstone.gatherer.Gatherer; 47 import org.greenstone.gatherer.Message;48 47 import org.greenstone.gatherer.cdm.CollectionDesignManager; 49 48 import org.greenstone.gatherer.cdm.CommandTokenizer; … … 75 74 import org.greenstone.gatherer.util.Utility; 76 75 import org.w3c.dom.*; 76 77 77 /** This class manages many aspects of the collection, from its creation via scripts, data access via methods and its importing and building into the final collection. It is also resposible for firing appropriate event when significant changes have occured within the collection, and for creating a new metadata set manager as necessary. 78 78 * @author John Thompson … … 112 112 static final public int NO_SPECIAL_CASE = -1; 113 113 static final public int SPECIAL_DLS = 0; 114 115 /** Used to indicate the source of the message is the file collection methods. */ 116 static final public int COLLECT = 3; 117 /** Used to indicate the source of the message is the building methods. */ 118 static final public int BUILDING = 5; 119 114 120 /** Constructor. */ 115 121 public CollectionManager() { … … 164 170 } 165 171 args = ArrayTools.add(args, collection.build_options.getBuildValues()); 166 GShell shell = new GShell(args, GShell.BUILD, Message.BUILDING, this, build_monitor, GShell.GSHELL_BUILD);172 GShell shell = new GShell(args, GShell.BUILD, BUILDING, this, build_monitor, GShell.GSHELL_BUILD); 167 173 shell.addGShellListener(Gatherer.g_man.create_pane); 168 174 shell.start(); … … 726 732 collection_import = null; 727 733 args = ArrayTools.add(args, collection.build_options.getImportValues()); 728 GShell shell = new GShell(args, GShell.IMPORT, Message.BUILDING, this, import_monitor, GShell.GSHELL_IMPORT);734 GShell shell = new GShell(args, GShell.IMPORT, BUILDING, this, import_monitor, GShell.GSHELL_IMPORT); 729 735 shell.addGShellListener(Gatherer.g_man.create_pane); 730 736 shell.start(); … … 871 877 } 872 878 } 873 GShell process = new GShell(command, GShell.NEW, Message.COLLECT, this, null, GShell.GSHELL_NEW);879 GShell process = new GShell(command, GShell.NEW, COLLECT, this, null, GShell.GSHELL_NEW); 874 880 process.addGShellListener(this); 875 881 process.run(); // Don't bother threading this... yet … … 877 883 878 884 /** Any implementation of GShellListener must include this method to allow the GShell to send messages to listeners. However in this case the CollectionManager is in no way interested in what the messages are, just the import events which have a specific type and are handled elsewhere. Thus we can safely ignore this event. 879 880 885 * @param event A <strong>GShellEvent</strong> which contains a the message. 886 */ 881 887 public synchronized void message(GShellEvent event) { 882 888 } 883 889 /** Called whenever the metadata value changes in some way, such as the addition of a new value. We want to mark the collection so that it needs saving again. 884 885 886 890 * @param event A <strong>MSMEvent</strong> containing details of the event that caused this message to be fired. 891 * @see org.greenstone.gatherer.collection.Collection 892 */ 887 893 public void metadataChanged(MSMEvent event) { 888 894 // Again this change means we need to save the collection again. … … 890 896 } 891 897 /** This call is fired whenever a process within a GShell created by this class begins. 892 893 894 895 896 898 * @param event A <strong>GShellEvent</strong> containing information about the GShell process. 899 * @see org.greenstone.gatherer.Gatherer 900 * @see org.greenstone.gatherer.gui.GUIManager 901 * @see org.greenstone.gatherer.shell.GShell 902 */ 897 903 public synchronized void processBegun(GShellEvent event) { 898 904 Gatherer.println("CollectionManager.processBegun(" + event.getType() + ")"); … … 1186 1192 catch (Exception exception) { 1187 1193 JOptionPane.showMessageDialog(Gatherer.g_man, "Exception detected during collection install.\nMost likely caused by Windows or Local Library holding locks on files:\n" + exception.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); 1188 }1189 }1190 1191 /** Creates and dispatches a message given the initial details.1192 * @param level An <i>int</i> indicating the message level for this message.1193 * @param message A <strong>String</strong> which contains the payload of this message.1194 * @see org.greenstone.gatherer.Log1195 * @see org.greenstone.gatherer.Message1196 */1197 private void message(int level, String message) {1198 Message msg = new Message(Message.COLLECT, level, message);1199 if(Gatherer.g_man != null) {1200 Gatherer.log.add(msg);1201 } else {1202 Gatherer.println(msg.toString());1203 1194 } 1204 1195 } … … 1404 1395 /** Any action that changes one of the tree models within a collection, which are the only models we listen to, mean the collections contents have changed and so saved should be set to false. 1405 1396 * @param event A <strong>TreeModelEvent</strong> encompassing all the information about the event which has changed the tree. 1406 1397 */ 1407 1398 public void treeNodesChanged(TreeModelEvent event) { 1408 1399 if(collection != null) { … … 1411 1402 } 1412 1403 /** Any action that changes one of the tree models within a collection, which are the only models we listen to, mean the collections contents have changed and so saved should be set to false. 1413 1414 1404 * @param event A <strong>TreeModelEvent</strong> encompassing all the information about the event which has changed the tree. 1405 */ 1415 1406 public void treeNodesInserted(TreeModelEvent event) { 1416 1407 if(collection != null) { … … 1419 1410 } 1420 1411 /** Any action that changes one of the tree models within a collection, which are the only models we listen to, mean the collections contents have changed and so saved should be set to false. 1421 1422 1412 * @param event A <strong>TreeModelEvent</strong> encompassing all the information about the event which has changed the tree. 1413 */ 1423 1414 public void treeNodesRemoved(TreeModelEvent event) { 1424 1415 if(collection != null) { … … 1427 1418 } 1428 1419 /** Any action that changes one of the tree models within a collection, which are the only models we listen to, mean the collections contents have changed and so saved should be set to false. 1429 1430 1420 * @param event A <strong>TreeModelEvent</strong> encompassing all the information about the event which has changed the tree. 1421 */ 1431 1422 public void treeStructureChanged(TreeModelEvent event) { 1432 1423 if(collection != null) {
Note:
See TracChangeset
for help on using the changeset viewer.