Changeset 4351


Ignore:
Timestamp:
2003-05-27T15:17:37+12:00 (21 years ago)
Author:
jmt12
Message:

Added new local library server command to release collection before installing the building directory to index - John

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java

    r4347 r4351  
    6666import org.greenstone.gatherer.undo.UndoManager;
    6767import org.greenstone.gatherer.util.ArrayTools;
     68import org.greenstone.gatherer.util.GSDLSiteConfig;
    6869import org.greenstone.gatherer.util.MetadataXML;
    6970import org.greenstone.gatherer.util.SynchronizedTreeModelTools;
     
    867868                collection.setBuilt(true);
    868869                // If we have a local library running (that we know about) then we ask it to add our newly create collection
    869                 System.err.println("Check if we should reset local server.");
     870                ///ystem.err.println("Check if we should reset local server.");
    870871                if(Gatherer.config.exec_file != null) {
    871                     System.err.println("Local Library Found!");
    872                     Gatherer.g_man.preview_pane.resetServer();
    873                 }
    874                 else {
    875                     System.err.println("GLI can't recognize a local library.");
    876                 }
     872                     ///ystem.err.println("Local Library Found!");
     873                    Gatherer.g_man.preview_pane.configServer(GSDLSiteConfig.ADD_COMMAND + collection.getName());
     874                }
     875                //else {
     876                ///ystem.err.println("GLI can't recognize a local library.");
     877                //}
    877878                // Signal collection changed.
    878879                workspace_model = null;
     
    10351036     private void installCollection() {
    10361037          Gatherer.println("Build complete. Moving files.");
    1037           File index_dir = new File(getCollectionIndex(), "temp.txt");
    1038           index_dir = index_dir.getParentFile();
    1039           Gatherer.println("Index = " + index_dir.getAbsolutePath());
    1040           if(index_dir.exists()) {
    1041                 Utility.delete(index_dir);
    1042           }
    1043           File build_dir = new File(getCollectionBuild(), "temp.txt");
    1044           build_dir = build_dir.getParentFile();
    1045           Gatherer.println("Build = " + build_dir.getAbsolutePath());
    1046           build_dir.renameTo(index_dir);
    1047           File new_build = new File(getCollectionBuild(), "temp.txt");
    1048           new_build = new_build.getParentFile();
    1049           new_build.mkdir();
     1038         
     1039          try {
     1040                // We have to ensure that the local library
     1041                if(Gatherer.config.exec_file != null) {
     1042                     ///ystem.err.println("Local Library Found!");
     1043                    Gatherer.g_man.preview_pane.configServer(GSDLSiteConfig.RELEASE_COMMAND + collection.getName());
     1044                }
     1045               
     1046                File index_dir = new File(getCollectionIndex(), "temp.txt");
     1047                index_dir = index_dir.getParentFile();
     1048                Gatherer.println("Index = " + index_dir.getAbsolutePath());
     1049               
     1050                if(index_dir.exists()) {
     1051                     Utility.delete(index_dir);
     1052                }
     1053
     1054                if(index_dir.exists()) {
     1055                     throw(new Exception("Index directory cannot be removed."));
     1056                }
     1057               
     1058                File build_dir = new File(getCollectionBuild(), "temp.txt");
     1059                build_dir = build_dir.getParentFile();
     1060                Gatherer.println("Build = " + build_dir.getAbsolutePath());
     1061                build_dir.renameTo(index_dir);
     1062
     1063                File new_build = new File(getCollectionBuild(), "temp.txt");
     1064                new_build = new_build.getParentFile();
     1065
     1066                if(new_build.exists()) {
     1067                     throw(new Exception("Build directory cannot be moved."));
     1068                }
     1069
     1070                new_build.mkdir();
     1071          }
     1072          catch (Exception exception) {
     1073                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);
     1074          }
    10501075     }
    10511076     /** Creates and dispatches a message given the initial details.
Note: See TracChangeset for help on using the changeset viewer.