This is a write-up of a method of modifying DSpace to allow the embargoing of documents submitted to a repository. The other method on the DSpace wiki is written for an older version of DSpace and the instructions no longer (at least clearly) apply to 1.4.2.
This method was published to the DSpace users mailing list by Jose Blanco at the University of Michigan, but the current archive of the thread is on SourceForge does not contain the correct files needed to perform the modification, and is not easy to understand for those unfamiliar to complex DSpace customizations. With help from Graeme Fox at Massey University in New Zealand, I was able to apply the embargo modification to our repository. These instructions should hopefully guide you through the process.
How It Works
This modification works by essentially adding another piece of metadata to the documents that need to be embargoed, which is stored in a new table in the postgres database. The new code checks against the database to ensure that an item is allowed to be accessed, and if it is under embargo a custom page is displayed that states the item is not available. A script runs on a frequency you set (likely daily) that checks the table in the database and removes the embargo if the date initially specified has been reached, which allows it to be accessed. Note that I did not develop this code and am simply stating my understanding of the modification based on the code.
To Be Noted
Items placed under embargo DO NOT appear in the repository in any way. It is as if they were never entered in the first place. If you wish to see what items are currently under embargo, you will need to access your database directly and view the new table. Items can be released by manually modifying the embargo date. If you wish for the metadata or portions of the document to be accessible (such as an abstract), this solution will likely not be satisfactory.
Place New Files
- Place Restrict.java in <dspace-source>/src/org/dspace/app/webui/util
- Place ReleaseRestricted.java in <dspace-source>/src/org/dspace/administer/
- Place ReleaseRestrictedItems.sh in <dspace>/bin
- Place embargo.jsp in <dspace-source>/jsp/local/
It's likely a good idea to back up any files you are going to modify before you begin changing anything.
First, modify <dspace>/bin/ReleaseRestrictedItems.sh, replacing email@example.com with the proper administer email address. You may wish to modify <dspace-source>/jsp/local/embargo.jsp to include less generic information, as well.
Following the initial imports, add this:
Line 260 (in my file, DSpace 1.4.2) follows four lines stating:
Following the last line, remove this code:
and insert the following code:
I'm uncertain as to what the removal of the tombstone code does, but it appears to have no adverse effects. For more details concerning this, please see the original thread.
Following the initial imports, add this:
After this section of code (I'm not sure if it needs to be placed here, but I followed Graeme's files as a model):
insert the following:
Add the following field to the appropriate forms:
and the following code in the section for value-pairs:
Create Database Tables
Using your postgres tool of choice, issue the following command to create the proper table in your dspace database:
In Oracle, the DEFAULT clause isn't legal, and doing the equivalent with a trigger actually breaks it, so the following may be what's needed. (Code by gmcgath, not fully tested but seems to work.)
Update DSpace and Test
Do whatever you usually do to update your installation of DSpace. Everything should (hopefully) compile correctly during your update. Test to see if the embargo code is functioning in your input form. You can also pull up the umrestricted table to see any embargoed documents you enter into the collection, and notice how the embargo date is entered. This is the only way I know of to change embargo dates and remove the embargo from a document (change the embargo date to the current one).
Set Up Daily Embargo Job
Once you are certain the code works, the final step is setting up the daily ReleaseRestrictedItems.sh job. You can do this in any way your system supports. The script checks the database table and releases items that are no longer under embargo.
I hope this guide works for you. I've tried to remember all the small steps and issues I overcame in adding the embargo feature to our repository. Of course, thanks goes to Jose Blanco for sharing this in the first place, and Graeme Fox for helping me parse through everything.