Changeset 26402

Show
Ignore:
Timestamp:
25.10.2012 17:50:57 (7 years ago)
Author:
ak19
Message:

Fixed issue with deleting fedora collections from GLI: it would start a process to call the new g2f-deletecol script and then immediately continue by deleting the collection directory. Unfortunately, the collection directory needs to be around until the script has finished purging the docs from fedora: the GS3 collection dir is how the g2f-deletecol.pl script works out what files (which pids) need purging.

Location:
main/trunk/gli
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/classes/dictionary.properties

    r25826 r26402  
    417417DeleteCollectionPrompt.Details:Creator - {0}\nMaintainer - {1}\nDescription\n{2} 
    418418DeleteCollectionPrompt.Failed_Delete:Collection could not be completely deleted. 
     419DeleteCollectionPrompt.Failed_Fedora_Delete:Error trying to purge collection from Fedora. 
    419420DeleteCollectionPrompt.Failed_Title:Deletion Failed! 
    420421DeleteCollectionPrompt.No_Collection:No collection selected. 
  • main/trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java

    r26333 r26402  
    111111    //static private GShellProgressMonitor fedora_coldelete_monitor = null; 
    112112 
     113    static private String delete_collection_name = null; 
     114 
    113115    /** The name of the standard lock file. */ 
    114116    static final public String LOCK_FILE = "gli.lck"; 
     
    861863        GShell shell = new GShell(command_parts, GShell.DELETE, COLLECT, this, null, GShell.GSHELL_FEDORA_COLDELETE); // fedora_coldelete_monitor set to null 
    862864        shell.start(); 
    863     } 
    864  
    865     // Delete the collection on the server if we're using a remote Greenstone 
    866     if (Gatherer.isGsdlRemote) { 
    867         Gatherer.remoteGreenstoneServer.deleteCollection(collection_name); 
    868     } 
    869  
    870     // if Greenstone3, need to deactivate the collection on the server 
    871     if (Gatherer.GS3) { 
    872         Gatherer.configGS3Server(Configuration.site_name, ServletConfiguration.DEACTIVATE_COMMAND + collection_name); 
    873     } 
    874      
    875     // Now delete the collection directory 
    876     return Utility.delete(new File(getCollectionDirectoryPath(collection_name))); 
     865 
     866        delete_collection_name = collection_name; 
     867        return true; // we assume it succeeded for now, wait until the process returns 
     868        // and then proceed to delete the collection directory 
     869    } 
     870    else { // not a fedora collection 
     871 
     872        // Delete the collection on the server if we're using a remote Greenstone 
     873        if (Gatherer.isGsdlRemote) { 
     874        Gatherer.remoteGreenstoneServer.deleteCollection(collection_name); 
     875        } 
     876         
     877        // if Greenstone3, need to deactivate the collection on the server 
     878        if (Gatherer.GS3) { 
     879        Gatherer.configGS3Server(Configuration.site_name, ServletConfiguration.DEACTIVATE_COMMAND + collection_name); 
     880        }        
     881        // Now delete the collection directory 
     882        return Utility.delete(new File(getCollectionDirectoryPath(collection_name))); 
     883    } 
    877884    } 
    878885 
     
    17201727        } 
    17211728    } 
     1729 
     1730    else if(event.getType() == GShell.DELETE) { 
     1731 
     1732        // we can only get here if we tried to delete a fedora collection 
     1733 
     1734        if(event.getStatus() == GShell.ERROR) { // error purging the collection from fedora 
     1735         
     1736        JOptionPane.showMessageDialog(Gatherer.g_man,Dictionary.get("DeleteCollectionPrompt.Failed_Fedora_Delete", new String[]{delete_collection_name}),Dictionary.get("DeleteCollectionPrompt.Failed_Title"),JOptionPane.WARNING_MESSAGE); 
     1737        delete_collection_name = null; // re-zero 
     1738        } 
     1739         
     1740        else if(event.getStatus() == GShell.OK) { // fedora purge was successful 
     1741 
     1742        if(delete_collection_name != null) { 
     1743            if (Gatherer.isGsdlRemote) { 
     1744            Gatherer.remoteGreenstoneServer.deleteCollection(delete_collection_name); 
     1745            } 
     1746             
     1747            // if Greenstone3, need to deactivate the collection on the server 
     1748            if (Gatherer.GS3) { 
     1749            Gatherer.configGS3Server(Configuration.site_name, ServletConfiguration.DEACTIVATE_COMMAND + delete_collection_name); 
     1750            } 
     1751 
     1752            // Now at last, can delete the collection directory as for a normal collection 
     1753            boolean success = Utility.delete(new File(getCollectionDirectoryPath(delete_collection_name))); 
     1754 
     1755            if (!success) { 
     1756            JOptionPane.showMessageDialog(Gatherer.g_man,Dictionary.get("DeleteCollectionPrompt.Failed_Delete", new String[]{delete_collection_name}),Dictionary.get("DeleteCollectionPrompt.Failed_Title"),JOptionPane.WARNING_MESSAGE); 
     1757            } 
     1758            delete_collection_name = null; // re-zero 
     1759        } 
     1760 
     1761        } 
     1762    } 
     1763 
    17221764    else if (event.getStatus() == GShell.CANCELLED) { 
    17231765        JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("CollectionManager.Build_Cancelled"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE); 
  • main/trunk/gli/src/org/greenstone/gatherer/gui/DeleteCollectionPrompt.java

    r19272 r26402  
    344344        list_model.removeElement(collection); 
    345345 
    346         resultPrompt(true); 
     346        if (!Configuration.fedora_info.isActive()) { // for fedora collections, delete in background 
     347            resultPrompt(true); 
     348        } 
    347349        details.setText(Dictionary.get("DeleteCollectionPrompt.No_Collection")); 
    348350        confirmation.setEnabled(false);