Compare commits

...

743 Commits

Author SHA1 Message Date
Mark Diggory
859059fc8b New location for DSpace Project
git-svn-id: http://scm.dspace.org/svn/repo/dspace/tags/dspace-1_5@3767 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2009-05-11 19:57:57 +00:00
Scott Phillips
7b0f22d0ed [maven-release-plugin] copy for tag dspace-1_5
git-svn-id: http://scm.dspace.org/svn/repo/tags/dspace-1_5@2868 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-25 02:26:20 +00:00
Scott Phillips
287f18b7bd (Scott Phillips) Updated known bugs
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2866 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-24 15:20:57 +00:00
Scott Phillips
7a6d57eab7 (Scott Phillips) Added a licensing notice stating the copyright has transfered from HP+MIT to DSpace
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2865 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-24 15:20:28 +00:00
Scott Phillips
c802b0e07b (Scott Phillips) Fixed i18n issues with URLencoding. Changing this parameter brigs Manakin in-line with the encoding that the JSPUI uses. This also requires that your servlet container be configured to use UTF-8 for URIs or otherwise parameters encoded in the URL will not be properly handled. For tomcat follow the steps outlined in the manual to set your connector's URIencoding parameter to UTF-8
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2864 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-22 19:38:54 +00:00
Mark Diggory
0680bac6cb Asure handle server logs to its own log and dspace is not in control of logging.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2863 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-21 21:22:31 +00:00
Mark Diggory
5896a03b93 Use authentication fall-through similar to shibboleth for certificate based auth with x509
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2862 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-21 06:03:42 +00:00
Graham Triggs
79753e0968 Fix bug #1872213 - getNumItems fails with Oracle
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2861 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-20 11:01:10 +00:00
Scott Phillips
3531fdcd1b (Scott Phillips) Removed check for email & password to be null, this breaks shibboleth. Instead if either email or password is null we'll set it to a "" value.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2860 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-19 19:48:31 +00:00
Scott Phillips
7cd56ee896 (Scott Phillips) Removed system.out.println
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2859 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-19 17:46:36 +00:00
Graham Triggs
3b3022dec7 Missing key: jsp.dspace-admin.workflow-abort-confirm.button
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2858 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-19 14:55:44 +00:00
Scott Phillips
c4328172a9 [maven-release-plugin] prepare for next development iteration
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2857 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-18 18:51:15 +00:00
Scott Phillips
6d3b14a693 [maven-release-plugin] prepare release dspace-1_5-rc1
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2855 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-18 18:48:27 +00:00
Scott Phillips
30708a3cd2 (Scott Phillips) Community names were being doubled in the bread crumbtrail, this has been fixed.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2854 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-18 18:28:00 +00:00
Scott Phillips
4ff60c2671 (Scott Phillips) fixed a display issues where the alphabet list would break to two lines.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2853 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-18 07:02:22 +00:00
Scott Phillips
0effc6858c (Scott Phillips) Added support for aspects to have their own i18n files automaticaly added.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2852 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-18 05:27:15 +00:00
Scott Phillips
d72aafe3e4 (Scott Phillips) Added protection against NPEs during authentication.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2851 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-18 05:26:07 +00:00
Scott Phillips
e5c8802032 (Scott Phillips) Added two configuration parameters to support multiple ways of using the handle server.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2850 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-18 05:25:07 +00:00
Scott Phillips
7be6116ae9 (Scott Phillips) Fixed a bug where the new.xml file was not being read. I changed the file to news-xmlui.xml so that it lists well with the other news files for the jspui. I also have supplied a default version of this file.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2849 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-18 05:23:13 +00:00
Scott Phillips
2ccd24fdeb (Scott Phillips) Fixed an i18n character encoding issues when search queries used special characters the next/previous links were not being encoded/decoded properly. I also change it so that search uses GET instead of POST. The reason is that this exposes the url so researchers can prepare queries then save a link to their query.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2848 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-18 05:21:16 +00:00
Mark Diggory
f8a793fd5d Adjust all modules to be under a simpler naming convention so that rebranding does not have to be of the war/webapp names themselves.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2847 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-17 21:26:36 +00:00
Mark Diggory
1cad5fdf30 Adjust all modules to be under a simpler naming convention so that rebranding does not have to be of the war/webapp names themselves.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2846 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-17 21:15:17 +00:00
Mark Diggory
a1c7729e2b Adjust all modules to be under a simpler naming convention so that rebranding does not have to be of the war/webapp names themselves.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2845 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-17 21:14:40 +00:00
Tim Donohue
05bc786cc5 Closed a TableRowIterator which was potentially left open in the Harvester...
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2844 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-17 15:27:55 +00:00
Mark Diggory
a3591d4cc9 svn:ignores
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2843 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-14 21:49:46 +00:00
Mark Diggory
092d628beb svn:ignores
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2842 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-14 21:49:40 +00:00
Mark Diggory
f137aa9173 correct id of snapshot repository.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2841 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-14 04:55:34 +00:00
Scott Phillips
0750151652 (Scott Phillips) Added a DTD for the xmlui.xconf
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2840 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-13 22:44:19 +00:00
Scott Phillips
c38fa39894 (Scott Phillips) Fixed bug when browsing by authors using non-ascii characters the link was not properly being decoded.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2839 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-13 22:22:21 +00:00
Scott Phillips
233c1389f4 (Scott Phillips) Recent submissions effects both interfaces.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2838 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-13 21:14:32 +00:00
Tim Donohue
f113ef749a MAJOR reorg of the 'dspace.cfg' file. Created sections to separate out "general configurations" (i.e. API-layer), XMLUI-specific, JSPUI-specific and ones that work in both those interfaces. (Oh, and obviously a section for SWORD & OAI)
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2837 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-13 20:57:30 +00:00
Scott Phillips
5cdc5a6ca9 (Scott Phillips) SupportedLocales now defaults to accept all locales if not defined.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2836 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-13 20:47:13 +00:00
Tim Donohue
2eb9eaf4fc minor updates to Windows install instructions
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2835 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-13 19:18:32 +00:00
Tim Donohue
777dd8261d Removed references to the old 'history' directory, and the 'history.dir' param from dspace.cfg
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2834 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-13 19:15:32 +00:00
Scott Phillips
604cd20193 (Scott Phillips) SF#1913521 Scoped searching (like scoped browsing)
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2833 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-13 18:01:54 +00:00
Graham Triggs
f536bcbe3b Fixed bug with the wrong operator used (&& instead of ||)
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2832 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-13 17:21:59 +00:00
Graham Triggs
7d47d443ae Fixed problem with thumbnails appearing multiple times if you include multiple dates in your list columns.
Also provides for a more attractive display, and faster table rendering.

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2831 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-13 16:19:15 +00:00
Tim Donohue
5c16cd85f2 Cleaned up the 1.5 Windows Install instructions. It previously contained a lot of Unix commands and Unix-specific language.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2830 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-13 15:08:06 +00:00
Mark Diggory
7947ae4400 Adjust xml declaration and include dspace-api-lang into build process if present.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2829 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-13 04:48:34 +00:00
Scott Phillips
39c94cf8ec (Scott Phillips) Added xmlui.user.loginredirect to determine where a user should go after logging into the system.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2828 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-13 02:55:12 +00:00
Scott Phillips
1726023d8f (Scott Phillips) SF#1898915 - Exception displayed on delete of ePerson that has submitted
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2827 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-13 02:00:37 +00:00
Scott Phillips
8b13f10354 (Scott Phillips) SF#1913091 - JSPUI & XMLUI: Problem deleting Collection-associated groups
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2826 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-12 23:02:30 +00:00
Tim Donohue
7f1ba494b7 Fix for SF Bug # [ 1904131 ] <visibility>workflow</visibility> doesn't work in manakin
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2825 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-12 22:07:02 +00:00
Scott Phillips
ba37b8c9d8 (Scott Phillips) Print out more information when a bitstream fails to be "filtered"
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2824 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-12 21:45:01 +00:00
Scott Phillips
846383002d (Scott Phillips) SF#1912952 - XMLUI: Cannot add Person to Group with auto-generated name
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2823 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-12 21:14:43 +00:00
Tim Donohue
eccff05471 Updates to the DRI Schema version 1.1 from Scott Phillips.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2822 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-12 21:09:18 +00:00
Scott Phillips
96cb5dc8f4 (Scott Phillips) Add DRI Schema Reference to the DSpace manual
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2821 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-12 20:18:05 +00:00
Tim Donohue
e08b93f22b Minor changes to documentation...added 'dspace-sword' to directories listing.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2820 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-12 17:19:54 +00:00
Graham Triggs
1b12c9b411 Restructured to allow incremental display of the table (useful if you are rendering 100 items on a page!)
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2819 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-12 16:09:15 +00:00
Graham Triggs
917dc06608 Corrections to Oracle schema
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2817 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-12 12:08:19 +00:00
Scott Phillips
09745a7f2a (Scott Phillips) Corrected target description.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2816 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-12 06:02:28 +00:00
Scott Phillips
c999a0e4a3 (Scott Phillips) Added shibboleth options to disable editing of metadata and registration of new users if desired.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2815 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-12 06:01:29 +00:00
Scott Phillips
e6de46f8fc (Scott Phillips) Removed hidden form item, replaced with a hidden field on the division. This resulted in a blank item being placed in the form.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2814 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-12 05:59:57 +00:00
Scott Phillips
d9562fa135 (Scott Phillips) Fixes display bug in IE6&7 on the submission submit buttons.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2813 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-12 05:58:58 +00:00
Scott Phillips
d27e6c5495 (Scott Phillips) Added protection for untitled communities or collections - the api no longer returns the string "untitled" if none exists.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2812 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-12 01:10:21 +00:00
Scott Phillips
b9df351a05 (Scott Phillips) Added the missing general Untitled tag
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2811 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-12 01:09:32 +00:00
Scott Phillips
2159ed015c (Scott Phillips) Split the update task into two: update_code and update_webapps. Also added the "-Dwars=true" switch to create war files.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2810 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-12 00:32:34 +00:00
Tim Donohue
91182585b8 Force assembly to use 2.2-beta-1, so that everything works on Maven 2.0.8
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2809 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-11 21:34:43 +00:00
Tim Donohue
bc2eb357e0 Fix for [ SF# 1896466 ] 1.5 install breaks in Windows with spaces in path names
The file path arguments in ANT should have single quotes (' ') around them, to ensure that filepaths with spaces are passed properly to the Load Registry scripts.

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2808 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-11 18:00:59 +00:00
Mark Diggory
92fce7009a add trailing slashes to complete uri for webapps to be created correctly.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2807 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-11 15:22:24 +00:00
Mark Diggory
c5dd9a1d59 don't use version in war plugin.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2806 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-11 15:16:09 +00:00
Scott Phillips
fe4a46e112 [maven-release-plugin] prepare for next development iteration
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2803 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-11 02:00:23 +00:00
Scott Phillips
4b9822844a [maven-release-plugin] prepare release dspace-1.5-beta2
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2801 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-11 01:59:40 +00:00
Mark Diggory
4da43dc226 Releases of language packs completed. Now using version ranges [1.5.0.0-1.6.0.0) to support resolution of these dependencies.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2800 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-11 01:13:14 +00:00
Mark Diggory
4d72aa9765 getting project name consistent with other module projects.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2799 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-11 00:36:45 +00:00
Mark Diggory
ada9621329 1.) Moving language-packs to dspace-sandbox. See: http://dspace-sandbox.googlecode.com/svn/modules/dspace-api-lang/trunk/
2.) Adjusting dependencies and dspace-api-lang project name
3.) Cleaning up versioning in poms, removing uneccessary dependencies and version tag
4.) consolidating wars generated so that dspace-xxx-webapp wars are skinny by default.

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2798 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-10 23:45:36 +00:00
Mark Diggory
57969f1c1a Do likewise for war files. However, overlays will not include dependent wars META-INF directories.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2797 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-08 00:31:13 +00:00
Mark Diggory
9362ba7dfe Add Maven metadata to Manifests.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2796 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-08 00:23:13 +00:00
Mark Diggory
b9c3558290 rename generated webapps and force assembly to use 2.2-beta-1
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2795 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-07 23:16:10 +00:00
Scott Phillips
2f8a587158 (Scott Phillips) Added OpenOffice document formats to the default format registry.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2794 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-07 19:53:12 +00:00
Scott Phillips
87e777afe0 (Scott Phillips) SF#1908952 - Office 2007 formats cannot be added to FormatRegistry
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2793 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-07 17:33:32 +00:00
Graham Triggs
e2d567bb2b Fix Oracle upgrade script
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2791 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-07 12:04:08 +00:00
Scott Phillips
2e734699d7 (Scott Phillips) Reduce the number of duplicate language tags for common strings such as Next, Save, Confirm, Delete, etc...
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2790 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-05 00:26:11 +00:00
Scott Phillips
40d62f2e59 (Scott Phillips) Added support for xmlui.supported.locales parameter so that an administrator can choose which languages to deploy Manakin in.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2788 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-04 05:48:48 +00:00
Mark Diggory
a2bfa070e5 remove files accidentally commited.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2787 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-04 05:03:36 +00:00
Mark Diggory
ce1c3df0f3 remove tools.jar dependency
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2786 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-04 05:02:18 +00:00
Mark Diggory
4c399d476f Commit properties generated from native2ascii
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2785 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-04 05:01:29 +00:00
Mark Diggory
c4bd8d7b09 remove i18n transformation because it doesn't work easily on all platforms. Reserve UTF* native2ascii functionality to profiles for those who wish to use it to assist in editing.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2784 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-04 04:57:59 +00:00
Scott Phillips
e5ab31db62 (Scott Phillips) webui.content_disposition_threshold -> xmlui.content_disposition_threshold
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2783 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-04 03:20:21 +00:00
Scott Phillips
bb435de720 (Scott Phillips) SF#1896186 - mail.charset not documented in dspace.cfg
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2782 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-04 01:41:06 +00:00
Scott Phillips
78cbab2532 (Scott Phillips) Removed useless common problem.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2781 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-04 00:46:49 +00:00
Scott Phillips
f3875f0f4c (Scott Phillips) SF#1896521 - Manakin XMLUI ignores content disposition threshold
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2780 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-04 00:35:58 +00:00
Scott Phillips
5bda6eef92 (Scott Phillips) SF#1897804 - non-administrator unable to create subcommunity
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2779 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-03 23:29:56 +00:00
Scott Phillips
62c5ef4ae2 (Scott Phillips) SF#1896183 - Special characters in xmlui
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2778 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-03 22:09:07 +00:00
Scott Phillips
96855565e0 (Scott Phillips) Added protection against communities and collections which have a null value title.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2777 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-03 22:07:45 +00:00
Scott Phillips
0cb094ebd6 (Scott Phillips) patch to prevent cocoon's cache from filling up your tomcat work directory with caches that will never be used.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2776 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-03 22:06:44 +00:00
Scott Phillips
da996aa6e1 (Scott Phililps) SF#1899958 - User appears logged in when not logged in
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2773 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-03-03 00:54:57 +00:00
Mark Diggory
9eeb44d604 fix rpoject version until release can be figured out.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2772 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-29 21:49:42 +00:00
Mark Diggory
12671885ad Make "all" active by default.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2771 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-29 21:15:11 +00:00
Mark Diggory
1e6b140f79 Release Management Steps are now Maven based. See wiki http://wiki.dspace.org/index.php/ReleaseProcedure
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2770 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-29 18:06:04 +00:00
Graham Triggs
f25634e45f Remove security problem with returning last-modified headers when logged in
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2768 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-29 15:29:19 +00:00
Scott Phillips
32d1549800 (Scott Phillips) SF#1896732 - Primary Bitstream flag no effect on bitstream display
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2767 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-29 00:46:31 +00:00
Mark Diggory
5a797e83c2 Undo previous commit and adjust release management profiles. We cannot currently build whole project from top level.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2766 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-28 23:45:58 +00:00
Mark Diggory
d6f727d22c Undo previous commit and adjust release management profiles. We cannot currently build whole project from top level.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2765 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-28 23:33:29 +00:00
Mark Diggory
dff6c4fc06 Qualifying the location with ${basedir} assures that build will work in both top level and inside the dspace directory.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2764 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-28 20:57:28 +00:00
Mark Diggory
7117f2a57b Needs to look for SNAPSHOT version as well until released.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2763 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-28 20:40:47 +00:00
Mark Diggory
df9296ce5c Exclude UTF-8 files from resulting jar.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2761 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-28 18:38:09 +00:00
Mark Diggory
ab48f68713 Detect Sun as vendor and look for tools jar appropriately.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2760 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-28 18:32:47 +00:00
Mark Diggory
62bb59178c Replace all Windows linefeeds found in source with unix linefeeds.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2752 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-28 15:23:41 +00:00
Graham Triggs
1507867370 Fix JDOM error if a metadatavalue is null
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2749 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-28 11:26:01 +00:00
Scott Phillips
fcac2f33e1 (Scott Phillips) Removed hardcoding of the bundle list out into the dspace.cfg parameter.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2748 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-28 06:58:30 +00:00
Scott Phillips
d15ec68fd8 (Scott Phillips) SF#1896265 - Browse result counts incorrect in xmlui
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2747 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-28 06:28:08 +00:00
Scott Phillips
17a8a62b0c (Scott Phillips) SF#1897647 - For a logged in user the submit button is allways displayed
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2746 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-28 05:01:46 +00:00
Scott Phillips
8ce735f415 (Scott Phillips) SF#1896943 - Manakin search glitch
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2742 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-28 04:47:23 +00:00
Scott Phillips
f4e90c9ffb (Scott Phillips) XMLUI will now allways lowercase your email address when checking to see if one allready exists. This caused problems when users tried to register accounts with different cases the API would fail later in the processes.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2736 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-28 03:38:23 +00:00
Scott Phillips
d74916e5ff (Scott Phillips) SF#1897998 'This collection' search label missing when using browse
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2732 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-28 02:59:32 +00:00
Scott Phillips
132791a9bd (Scott Phillips) SF#1898195 - Browse by pages are missing the 0-9 link.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2731 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-28 02:48:48 +00:00
Scott Phillips
1fdba83734 (Scott Phillips) SF#1899214 - The submission complete page did not have a trail or title which caused the theme to blow up when viewed in IE. I've added default trail and title for any submission page that dosn't have it allready and fixed it so that the theme dosn't blow up if there is not a trail or title.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2729 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-28 01:17:23 +00:00
Scott Phillips
66a3a72a94 (Scott Phillips) SF#1898491 The item summary-view page doesn't handle multiple metadata entries very well. Now it will:
title: one per line
authors: in one line but separated by semicolons.
abstract: entries seperated by a line
description: entries seperated by a line
URI: one per line
Date: one per line

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2728 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-28 00:19:06 +00:00
Mark Diggory
eae0d643b1 Watch those line delimiters Tim... Correcting windows line feeds in files.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2726 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-27 23:47:41 +00:00
Scott Phillips
89f707bbe2 (Scott Phillips) SF#1899170 Submission labeling error.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2725 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-27 23:24:07 +00:00
Scott Phillips
cdd0407efe (Scott Phillips) I broke messages.xml on my last commit, this fixes it.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2724 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-27 23:01:11 +00:00
Mark Diggory
bdeccb92d7 Build dspace-xmlui-lang if checked out into project workspace.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2723 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-27 22:50:19 +00:00
Mark Diggory
0e11e9929f Build dspace-xmlui-lang if checked out into project workspace.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2722 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-27 22:44:05 +00:00
Scott Phillips
7e751bc165 (Scott Phillips) SF#1899213 - Spelling error in "authorizations".
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2721 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-27 22:43:28 +00:00
Scott Phillips
e97ec51866 (Scott Phillips) SF#1899781 - Submission language save/cancel --> save & exit
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2720 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-27 22:31:26 +00:00
Mark Diggory
c0ad8911a0 Addining example for appassembler plugin.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2719 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-27 21:31:50 +00:00
Scott Phillips
6dd6bdfc72 (Scott Phillips) SF#1896110 - Long metadata fields cause problems in the workflow task/pool submission system. Added protection for these cases.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2718 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-27 21:31:21 +00:00
Scott Phillips
d521181881 (Scott Phillips) This is a collection of fixes to the base dri2xhtml style display.
SF#1896726 - if dates don't exist for the item don't put in ()
  SF#1895967 - don't display labels for fields that don't exist
  SF#1896039 - display the metadata schema
  SF#1896025 - display the new section for communities and collections
  SF#1896129 - show a message if an item has no files.
  SF#1896981 - full item display dosen't list the files.

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2717 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-27 21:28:24 +00:00
Mark Diggory
2e4644afb5 Remove unneccessary dependency on lni-core and make a executable jar with all the dependencies.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2716 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-27 21:19:33 +00:00
Graham Triggs
b9fc33ec64 Fix long standing bug with checking the dates on a resource policy
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2714 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-27 14:23:45 +00:00
Scott Phillips
43e335b3f2 (ScottPhillips) Removed unused tags.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2713 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-26 18:22:29 +00:00
Mark Diggory
e7965570a7 changes
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2712 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-23 00:56:44 +00:00
Mark Diggory
b7d40e3cf9 Place Messages.properties appropriately in resources and adjust documentation.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2711 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-23 00:54:26 +00:00
Mark Diggory
01ea1632e2 remove old directories
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2710 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-23 00:27:10 +00:00
Mark Diggory
61f8b077c7 Reorganize Language file to support easier editing, processing and management
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2709 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-23 00:25:30 +00:00
Mark Diggory
03c322c64c new proper location for properties files.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2708 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-22 23:42:35 +00:00
Tim Donohue
890a2ee33c Fixed Bug: SF #1899748 Comments box in feedback form display problem
Changed FeedbackForm aspect to no longer specify a size for the "comment" textarea.  That way the size can be controlled in your XMLUI theme.  So, right now, it defaults to a smaller size and looks better in Firefox & I.E.

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2707 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-22 18:06:28 +00:00
Tim Donohue
1a6c18fbf8 Fixed bug: SF#1899717 - Forced back to beginning of submission process
Changed the XMLUI to disable submitting forms when 'enter' is pressed, when the user is submitting a new item to DSpace.  This same logic already existed for the JSPUI.

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2706 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-22 17:48:06 +00:00
Scott Phillips
f9aa8b801b (Scott Phillips) Fixed language tags in the restricted item code that were not translatable into other languages because "item", "community", "collection" were being passed in as parameters to the string.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2705 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-21 18:01:06 +00:00
Claudia Juergen
68defbecef Update of German jspui language pack.
Status: compliant to 1.5beta1

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2704 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-21 12:33:09 +00:00
Tim Donohue
d946e8c23f Fixed bug SF#1897293 - Submission field Series/Report No. is ignored.
Changed the dc.relation.ispartofseries (Series/Report field) to the "series" input-type in input-forms.xml.  Added documentation around the "series" input type (which was strangely missing).  A few other small fixes to get JSP-UI & XML-UI to work the same for series.

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2703 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-20 22:46:41 +00:00
Mark Diggory
dfd8595b59 Adjust RSS feed location to be consistent with JSPUI https://sourceforge.net/tracker/index.php?func=detail&aid=1760739&group_id=19984&atid=119984
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2702 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-20 22:08:55 +00:00
Mark Diggory
236afd120e Adjust RSS feed location to be consistent with JSPUI https://sourceforge.net/tracker/index.php?func=detail&aid=1760739&group_id=19984&atid=119984
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2701 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-20 22:08:46 +00:00
Scott Phillips
e23a975e55 (Scott Phillips) SF#1895992 - No README at top level of src
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2700 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-20 21:05:04 +00:00
Scott Phillips
6656ea5543 (Scott Phillips) SF#1895881 - missing tag in language pack
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2699 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-20 20:55:29 +00:00
Scott Phillips
bca7af0390 (Scott Phillips) SF#1895858 - unable to send feedback email.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2698 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-20 20:50:09 +00:00
Tim Donohue
ac5809a9f6 Adding back in links to Submission Configuration documentation (in /docs/submission.html). They must've been accidentally removed before the 1.5 beta1 release.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2697 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-20 19:03:17 +00:00
Tim Donohue
7ad7ebb6b2 Very minor changes to install docs
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2696 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-20 17:57:08 +00:00
Tim Donohue
35a82face2 Fix to bug SF#1897927 - Checksum checker does not work. The ConfigurationManager was failing to load the default configuration file when "getProperties()" was called from Checksum checker.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2695 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-20 17:41:17 +00:00
Mark Diggory
a2438160c8 Adding SortOption.DESCENDING to correct issue with sort order. https://sourceforge.net/tracker/?func=detail&atid=119984&aid=1897968&group_id=19984
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2694 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-20 16:26:14 +00:00
Mark Diggory
5ac0d297ca Removing someones typo...
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2693 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-20 16:05:53 +00:00
Stuart Lewis
23c854e74e (Stuart Lewis) Updated upgrade instructions to include new crosswalk files for SWORD and metadata in html head
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2692 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-20 09:34:19 +00:00
Mark Diggory
36f31fe3ff Fix for https://sourceforge.net/tracker/?func=detail&atid=119984&aid=1896468&group_id=19984
Adding in missing tables that were recently added to dsatabase-schema.sql

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2691 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-20 00:31:24 +00:00
Mark Diggory
41acdb8e42 Add in dtd and input-forms to update directions. https://sourceforge.net/tracker/?func=detail&atid=119984&aid=1897039&group_id=19984
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2690 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-19 22:48:24 +00:00
Scott Phillips
dec9d3d458 (Scott Phillips) SF#1867394 Enable the option to include the xmlui.xconf inside the webapp's WEB-INF folder. If no configuration is found there then it will fall back to looking in the dspace/config directory.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2689 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-19 17:42:52 +00:00
Mark Diggory
edb3d434b0 Adjustments to layout
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2688 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-19 04:59:00 +00:00
Mark Diggory
ffe2255213 Updates to the documentation based on feedback from the test-a-thon.
Corrections to Maven based build and installation on Windows. 
Changed Copyright to be under The DSpace Foundation.

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2687 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-19 04:48:26 +00:00
Mark Diggory
0a677d7b03 svn ignore
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2686 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-16 17:13:22 +00:00
Mark Diggory
8293cad4e4 svn ignore
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2685 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-16 17:13:18 +00:00
Graham Triggs
d92276f5e1 Fix jump to for descending browse lists and date indexes
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2684 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-15 23:58:32 +00:00
Scott Phillips
c4354d213d (Scott Phillips) Fixed compile error in LogAnalyser.java - a miss typed method name.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2683 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-15 18:53:03 +00:00
Graham Triggs
45360e6341 Fix problem with unique metadata browses
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2681 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-15 15:30:34 +00:00
Stuart Lewis
9d7502c90d (Stuart Lewis) Updates to the stats scripts. (1) Better error reporting. (2) Adding the ability to enter start dates - these had been removed with the Java replacements for the previous Perl scripts. (3) Added upgrade instructions. (4) Tidied up dstat.cfg. (5) Hostname and service name now taken from dspace.cfg rather than dstat.cfg.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2680 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-15 15:07:39 +00:00
Graham Triggs
85c5a11771 Fix issue with the new pagination code when the browse tables are empty
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2679 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-15 14:54:48 +00:00
Graham Triggs
4829eda0b7 Fix pagination issues by using offsets
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2678 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-14 22:46:41 +00:00
Scott Phillips
e0db2d669a (Scott Phillips) Removed the indication that item mapper only searches authors when it actually searches any field.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2677 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-14 16:34:28 +00:00
Scott Phillips
bd18e7b1f3 (Dustin Slater) Updates to improve the visual style of the classic theme.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2676 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-14 16:05:10 +00:00
Scott Phillips
c077d8332f (Scott Phillips) SF#1893334 Fixed the missing trail not being displayed when browsing.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2675 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-14 16:03:51 +00:00
Stuart Lewis
4abd038cdd SWORD metadata registry - updated to make it 'complete', so it can standalone without the main dspace DC metadata registry.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2674 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-14 13:54:16 +00:00
Mark Diggory
49d92a70bd Adjust names of profiles so they make more sense.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2673 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-14 00:09:31 +00:00
Mark Diggory
365e6b8758 Use dspace-assembly-plugin version 1.1 in these projects.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2672 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-14 00:03:45 +00:00
Scott Phillips
4c0a043933 [maven-release-plugin] prepare for next development iteration
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2671 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-13 21:36:32 +00:00
Scott Phillips
96fd10b9bb [maven-release-plugin] prepare release dspace-1_5-beta1
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2669 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-13 21:35:51 +00:00
Mark Diggory
ac737c3c5d Make modules dir always on.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2668 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-13 20:50:37 +00:00
Mark Diggory
04ec225b77 include dspace for packaging and release, but not for deployment
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2667 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-13 20:48:38 +00:00
Mark Diggory
853e938c32 regenerate wsdl and code only whe -Dregenerate-wsdl=true is designated as a parameter.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2666 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-13 19:50:11 +00:00
Mark Diggory
f16f5129bd Correct some reporitory settings in POM so the dspace and snapshot repos are not always consulted.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2665 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-13 19:22:07 +00:00
Mark Diggory
a7d6b07c86 Use full version release of plugins now.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2664 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-13 19:09:27 +00:00
Graham Triggs
901c669991 Added missing DISTINCT on view for distinct query
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2662 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-13 16:24:47 +00:00
Graham Triggs
54b6e7b54b Changed the way browsing metadata indexes works when comm/coll scoped due to Postgres deficiency
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2661 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-13 16:20:19 +00:00
Graham Triggs
d78e5a3fc1 Make metadatavalue updates kinder to the database by only writing / deleting the difference between the current DB values and the in-memory values
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2660 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-13 06:41:18 +00:00
Mark Diggory
53d1247a63 Wait to make full release until its present in central repo. Build breaks otherwise.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2659 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-13 04:50:32 +00:00
Scott Phillips
9ce8ccd6c5 (Scott Phillips) Updated upgrade documentation to include item-submission.xml
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2658 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-13 03:33:59 +00:00
Scott Phillips
ac1bf1175c (Scott Phillips) Fixed an NPE where when attempting to URL encode a null string.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2657 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-13 02:07:12 +00:00
Scott Phillips
4d16a7b6e4 (Scott Phillips) Fixed an NPE in the withdrawn item that was preventing the page from loading.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2656 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-13 02:05:29 +00:00
Mark Diggory
0bef9480d2 Use locally release versions under org.dspace for Maven plugins, these are maintained at dspace-sandbox.googlecode.com
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2655 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-13 00:29:34 +00:00
Mark Diggory
a05f7e33bc Use official released i18n report plugin under org.dspace group id.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2654 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-12 23:31:18 +00:00
Graham Triggs
4f5478b05e getMetadata now returns an empty array rather than null
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2653 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-12 22:58:21 +00:00
Mark Diggory
2f5341b9d5 Assembly not properly creating webapp directories, they need to be expanded for web.xml to be properly filtered during the ant build.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2652 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-12 22:32:57 +00:00
Graham Triggs
b7a081a39a Add indexes to foreign key columns to avoid database contention
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2651 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-12 21:40:22 +00:00
Scott Phillips
e4b54d178e (Scott Phillips) Updated release script to build binary packages.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2650 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-12 20:46:31 +00:00
Scott Phillips
7ebeaf1358 (Elliot Metsger) SF# 1867408 Fixed errors where paragraphs were being translated into the DRI document out of order.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2649 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-12 19:56:25 +00:00
Scott Phillips
a7110ecb16 git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2648 9c30dcfa-912a-0410-8fc2-9e0234be79fd 2008-02-12 19:54:19 +00:00
Scott Phillips
e4812dbac5 (Jay Paz) Fixed a bug in the accessability of forms. Some fields were not having <labels> associated with them which makes it hard for screen readers or other alternative browsers to understand a form.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2647 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-12 18:30:29 +00:00
Scott Phillips
dad83eee50 (Scott Phillips) Fixed bug where the XMLTest aspect had the wrong default location, they were moved to the resource bundle.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2646 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-12 18:29:10 +00:00
Scott Phillips
f664232287 (Jay Paz) Fix to bug where lists where being wrapped within a paragraph thus creating an invalid dri and html documents.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2645 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-12 18:28:23 +00:00
Graham Triggs
fb506433d5 Fix problem with null browse index (can be null for browsing withdrawn items - will be set later)
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2643 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-12 14:54:57 +00:00
Graham Triggs
175176c0e9 Eliminate unnecessary item.update()
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2642 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-12 05:07:57 +00:00
Scott Phillips
1ebf74f9b6 (JamesCreel) The Kubrick theme, an generic non-university branded theme. This is an example theme provided with the base of dspace providing some examples on how to construct a theme using seperate style sheets, and XSL.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2641 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-12 00:16:09 +00:00
Graham Triggs
95ce6e31bc Eliminate most unnecessary changes to the database when values haven't been altered (reduces contention, and unnecessary constraint validation)
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2639 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-12 00:03:08 +00:00
Tim Donohue
05253c036b Updated 1.5 Documentation based on decision on path names in DSpace 1.5. [dspace-source] will refer to the source of either the 'dspace-1.5.tar.gz' or the 'dspace-1.5-src.tar.gz' (which will be the two distribution options via sourceforge). Also a few other smaller documentation changes.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2638 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-11 20:29:39 +00:00
Mark Diggory
07de727e27 Adjust release descriptors
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2637 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-11 19:55:23 +00:00
Scott Phillips
93521b35ff (ScottPhillips) Added a switch to enable the themepath parameter to an HTTP request directing which theme to load. This can be turned on via the xmlui.themes.allowoverrides configuration parameter which defaults to off.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2636 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-11 18:20:01 +00:00
Stuart Lewis
2cd82e602d SWORD metadata registry
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2635 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-11 16:31:27 +00:00
Graham Triggs
6a4967c492 Fix problem mapping distinct metadata values to items
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2633 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-11 12:23:22 +00:00
Graham Triggs
4fe54b6079 Fix problem searching by author in item mapping. Remove even more database contention (when editing / mapping items)
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2631 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-10 20:46:27 +00:00
Stuart Lewis
be03336a63 (Chris Yates) SF Patch #1888652 Statistics Rewritten In Java
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2630 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-10 19:09:14 +00:00
Graham Triggs
1050b4f54f Further reduce db contention when an item is updated
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2628 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-10 17:22:28 +00:00
Graham Triggs
5462c12830 Remove unused parts of the API, reduce db contention when an item is updated
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2626 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-10 16:51:01 +00:00
Graham Triggs
684da8831d Ensure item_count tables are correctly defined, including primary keys
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2624 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-09 22:47:41 +00:00
Graham Triggs
4f118f56bc Bring itemRemoved() in line with trunk
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2623 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-09 22:23:57 +00:00
Graham Triggs
f1a0135638 Add indexes to foreign key constraints to avoid table locking issues. Clean up some of the API for the browse tables.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2620 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-09 00:58:44 +00:00
Graham Triggs
6ba6658d41 Fix reversion of efficient index pruning
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2619 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-09 00:01:04 +00:00
Scott Phillips
5f03b20dcc (ScottPhillips) Updated the usage of [dspace-source] to be in-line with that used in directories.html
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2617 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-08 02:53:53 +00:00
Scott Phillips
a2a02166cf (ScottPhillips) Minor updates to the directory descriptions.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2616 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-08 02:53:15 +00:00
Scott Phillips
142639ea24 (Scott Phillips)
Added upgrade instructions for DSpace 1.4.2 to DSpace 1.5

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2615 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-08 02:36:07 +00:00
Scott Phillips
fba8c514fa (Scott Phillips)
Split index-all into index-init and index-update. index-init is run to re-initalize after a configuration change while index-update will just update the index for all items. This simplifies upgrading an existing DSpace by having one easy indexing command to run after the upgrade.

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2614 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-08 02:35:01 +00:00
Graham Triggs
f1549c6460 Updated efficiency and clarity of browse code. Much faster indexing at slight cost of lookup. Fix to normalisation code.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2613 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-08 00:56:30 +00:00
Mark Diggory
e27161bbca Remove I18N : Eliminate I18N class from core and adjust the only two locations it is still used in ChecksumChecker to use I18nUtil.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2612 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-08 00:02:37 +00:00
Tim Donohue
eafc594282 minor edits/fixes
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2611 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-07 21:34:27 +00:00
Tim Donohue
34e7fb245f Updated 'directories.html' with new 1.5 directory structure. Also added a section describing directory structure of the XML-UI web app.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2610 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-07 21:22:09 +00:00
Tim Donohue
2bbe5d8e65 Changed documented paths in configure.html as to where to customize Messages.properties
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2609 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-07 21:21:03 +00:00
Mark Diggory
1be495683d Copy of Messages.properties for customization purposes.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2608 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-07 20:35:28 +00:00
Mark Diggory
0881d201eb New home for customized i18n files
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2607 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-07 20:33:54 +00:00
Tim Donohue
a9d85fda04 Updated configuration instructions to detail how to now customize JSPs.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2606 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-07 19:30:35 +00:00
Tim Donohue
0d24be11b1 Updated install instructions based on the newest build architecture.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2605 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-07 19:15:34 +00:00
Mark Diggory
729af4b97c correct pom inheritance and dependency management
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2603 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-07 18:29:03 +00:00
Mark Diggory
257094f3e9 svn:ignore
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2602 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-07 18:14:50 +00:00
Mark Diggory
6de23b1860 Add dspace-sword overlay
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2601 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-07 18:14:15 +00:00
Mark Diggory
5b18028aef filter out dspace-sword-webapp so its not placed in webapps (overlay is placed there instead)
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2600 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-07 18:13:27 +00:00
Mark Diggory
ac9129535d Add skinny war generation to dspace-sword-webapp to support overlays
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2599 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-07 18:12:19 +00:00
Richard Jones
f2c42fea07 Add the new SWORD module to the 1.5.x branch. This includes the SWORD code, re-structured to meet the standards already laid out for the 1.5 release (top level project, with sub api and webapp projects). In addition to this the following additions have been made to the main part of DSpace, which will need to be removed again if SWORD is modularised out again:
- sword-swap-ingest.xsl has been included into config/crosswalks
- sword configuration has been added to dspace.cfg
- loading of the required fields for swap ingest has been added to the main build.xml
- references to dspace-sword have been added to all the relevant pom.xml files in the main for DSpace

Furthermore, this commit includes the source code for the common sword libraries.  These need really to be in the main maven repository, which I will work on as soon as possible before the 1.5 beta release.

This module has been tested to work previously, so it has not been extensively tested again.  Dependency issues in the build system may remain, which have notyet been discovered.

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2598 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-07 14:04:21 +00:00
Graham Triggs
6a4f72cb39 Make the browse indexing more robust to suspect data
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2595 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-06 16:56:52 +00:00
Graham Triggs
16c0d1599e Fix issue with second level browse (ie items for a particular subject) not allowing you to use the page controls
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2592 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-04 15:01:35 +00:00
Scott Phillips
33749b9ca8 (ScottPhillips) Documentation updates and the addition of Manakin.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2591 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-02-04 12:40:49 +00:00
Graham Triggs
ab71001443 Small fix to indexing of dates
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2588 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-31 16:52:09 +00:00
Mark Diggory
d20b75b75b Add in profile for building source and bootstrap release. Use it via 'mvn -Prelease package'
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2586 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-30 14:30:29 +00:00
Mark Diggory
97fc12b70c Ignore project targets.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2585 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-29 23:44:35 +00:00
Mark Diggory
eb606228b6 Importing the changes from the binary build prototype (mis-named). Provides example overlays where customization can occur.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2584 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-29 23:43:58 +00:00
Graham Triggs
07f131cebf PDF Filter can optionally extract text into a temporary file instead of memory (useful for very large PDFs)
PDF Filter can optionally skip bitstream extraction when an OutOfMemoryException is thrown (workaround to PDFBox error)
PDFBox version bumped to 0.7.3 to be in line with previous DSpace distributions
Lucene bumped to version 2.3.0 - no source changes required, compatible with existing indexes, indexing has up to 8x performance improvement

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2581 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-27 22:01:22 +00:00
Mark Diggory
0b5dece2da svn-ignore changes
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2577 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-27 02:13:44 +00:00
Mark Diggory
18015db26b svn ignore target and project files
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2576 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-27 02:05:05 +00:00
Mark Diggory
265a5e074c Complete JSPUI reorganization. Exclude OAI and JSPUI jars from showing in dspace/lib
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2575 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-27 01:37:53 +00:00
Mark Diggory
ae92d58737 Complete JSPUI reorganization. Adjust modules in dspace/pom.xml to reflect new jspui projects.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2574 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-27 01:35:20 +00:00
Mark Diggory
3aaaf4df55 Use SNAPSHOT for dspace-assembly-plugin
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2573 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-27 01:29:08 +00:00
Mark Diggory
97fefa48fa Complete JSPUI reorganization. Delete empty directories
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2572 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-27 01:28:23 +00:00
Mark Diggory
a598fba1b7 Complete JSPUI reorganization. Make required directory moves.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2571 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-27 01:26:50 +00:00
Mark Diggory
03a615480e Complete JSPUI reorganization. Make POM adjustments in parents.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2570 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-27 01:25:03 +00:00
Mark Diggory
02a619ae81 Complete JSPUI reorganization.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2569 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-27 01:24:08 +00:00
Graham Triggs
2e21feaaf8 Minor corrections following the generalisation of sort ordering
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2567 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-25 16:06:40 +00:00
Graham Triggs
0e2a014641 Add email validation to FeedbackServlet (Fix SF bug 1827579)
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2564 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-22 22:41:19 +00:00
Graham Triggs
fa9917a311 Fixed erroneous comment text
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2562 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-22 15:35:14 +00:00
Graham Triggs
3159fd2457 Add search ordering controls to Manakin
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2560 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-17 23:13:20 +00:00
Tim Donohue
80de1bdeed Fixing order of copy processes in 'ant update'. Previously it was overwriting everything in [dspace]/etc, and *then* backing that up to [dspace]/etc.back-{build.date}. Fixed it to perform backup of /etc first!
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2557 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-16 20:29:31 +00:00
Tim Donohue
04dd8f3a2d Adding 'target' directory to svn:ignore for both dspace-oai-api and dspace-oai-webapp
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2555 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-16 17:29:25 +00:00
Tim Donohue
622f9cbdb9 Added .settings (Eclipse Settings folder) and .tomcatplugin (Eclipse Tomcat Plugin settings) to svn:ignore
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2554 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-16 17:23:28 +00:00
Graham Triggs
86883adad0 Completed search reordering controls, made ItemListTag equivalent to BrowseListTag
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2553 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-16 16:46:44 +00:00
Graham Triggs
e74ee7391c Replace internal Sun Base64 encoder with Commons-codec
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2551 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-16 10:50:38 +00:00
Graham Triggs
c816a34268 Added distinct year indexing for dates
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2549 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-16 10:25:16 +00:00
Mark Diggory
64670b0d4e minor correction in parent
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2545 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-15 22:41:57 +00:00
Mark Diggory
62500276c6 This directory is no longer used.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2544 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-15 22:39:48 +00:00
Mark Diggory
83f5fa4991 Reorganize dspace-oai plugin to be structured identically to dspace-xmlui and dspace-lni plugins.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2543 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-15 22:36:36 +00:00
Graham Triggs
d6f05c84b0 Missing order parameter from page links
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2540 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-15 21:42:38 +00:00
Graham Triggs
7c41217e92 Fix ordering of community/collection/item, and add controls to alter number of results per page and sorting in search
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2538 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-15 21:26:35 +00:00
Mark Diggory
dbd1629978 Remove vestigial History tables from database schema and add DROP TABLE in update schemas.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2537 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-15 19:58:25 +00:00
Tim Donohue
8a6ae1c449 Updated 'echo' comments that are returned when running 'ant update' or 'ant fresh_install'. The comments had not been fully updated for the 1.5 build/install process.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2535 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-15 18:28:32 +00:00
Graham Triggs
4f540ea77b Make default search sorting Relevance in DESCENDING order (most relevant first), allows resorting to Relevance ASCENDING, and other options
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2533 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-15 16:44:17 +00:00
Graham Triggs
327349224c Fix problem with ordering community / collection / items
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2531 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-15 15:59:29 +00:00
Graham Triggs
501398ec1d Fix problem with DatabaseManager retrieving column information if the database contains multiple schemas
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2529 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-15 13:49:52 +00:00
Graham Triggs
be1878ae64 Fix quote parsing, remove oro dependency
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2527 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-15 13:36:30 +00:00
Stuart Lewis
d725244ffd (Stuart Lewis) SF Patch #1642563 bin/update-handle-prefix rewritten in Java
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2525 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-14 16:40:45 +00:00
Tim Donohue
e03e592c8e Upgrade instructions in 1.5.x branch were missing the latest instructions to upgrade from 1.4.x to 1.4.2
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2524 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-14 15:48:18 +00:00
Graham Triggs
1720f60664 Disabled unnecessary Lucene workaround
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2522 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-14 15:06:54 +00:00
Graham Triggs
a2f335d697 Improved resilience of query object when index is lacking necessary information, improve efficiency of search results by not using handles if the resource ID is available
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2521 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-13 19:19:19 +00:00
Graham Triggs
654462dbe0 Moved AbstractTextFilter to sort from browse
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2519 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-13 16:01:52 +00:00
Stuart Lewis
6d374b3a5b (Stuart Lewis) SF Patch #1642563 bin/update-handle-prefix rewritten in Java
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2518 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-12 15:51:04 +00:00
Tim Donohue
4beb0fa2bf An initial stab at updated installation instructions for DSpace 1.5. If there are details you see missing, feel free to add to it.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2517 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-11 22:41:04 +00:00
Mark Diggory
ed7d1af3b1 Fix missing ConfigurationLoad class.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2516 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-11 18:33:24 +00:00
Mark Diggory
f3f982b69a Fix missing ConfigurationLoad class.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2515 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-11 18:33:19 +00:00
Mark Diggory
7a966171ac Corrected compilation error
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2514 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-10 23:58:04 +00:00
Mark Diggory
68d057a2fd Corrected compilation error
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2513 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-10 23:44:33 +00:00
Mark Diggory
ffebcd417c bring along etc directory into install so that any sql upgrade code can be run from either dspace.home or from target/dspace-./
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2512 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-10 22:11:28 +00:00
Graham Triggs
d86af20a5a First part of search update - reduce search size, add in fields for sorting content, lessen dependency on handles
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2508 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-10 14:03:36 +00:00
Mark Diggory
4b4828ef0e Reordering Submission Aspect after EPerson Aspect corrects bug where "My Account" title disappears when logged in. Unsure why bug occurs.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2500 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-09 00:04:54 +00:00
Mark Diggory
9a2b9a68ea Do not include Item either if case is true.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2499 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-08 23:39:28 +00:00
Mark Diggory
063dc1ffd7 If the Auth Method href or title key is null, do not show it in the list of options.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2498 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-08 23:21:47 +00:00
Tim Donohue
bdcd65d78c Fixes to DTD based on merged version of the item-submission.xml
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2496 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-08 22:50:05 +00:00
Tim Donohue
cf734f6bfd Small bug fix to allow JSPUI and XMLUI to both allow skipping file upload during submission, if it is enabled in the dspace.cfg.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2492 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-08 18:56:45 +00:00
Tim Donohue
80356f5c2e Merged 'item-submission-JSPUI.xml' and 'item-submission-XMLUI.xml' files into a single 'item-submission.xml' configuration file (based on suggestions from Graham Triggs).
Small updates throughout API for Configurable Submission to support this merged configuration file (majority of changes in dspace-api and dspace-jspui modules).   Also includes updates to Configurable Submission documentation and small updates to I18N to make the XMLUI and JSPUI keys more parallel.

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2491 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-08 17:53:25 +00:00
Graham Triggs
0b8f5dc31c Fix feed generation to use descending order (so most recent items come first)
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2489 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-08 12:16:33 +00:00
Graham Triggs
007081224a Make it possible to specify multiple metadata fields to be used in a 'unique metadata' index - ie. dc.contributor.author,dc.contributor.advisor for the author list
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2486 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-07 15:52:27 +00:00
Graham Triggs
d1f8015bb5 Added missing copyright messages
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2482 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-05 06:31:33 +00:00
Tim Donohue
7301b832db Various bug fixes to JSP-UI file upload step:
Fixed NPE when no file selected to upload.  Fixed small bug in processing of upload-error.jsp (was not returning to file upload screen).  Fixed ability to enable *skipping* uploading a file during JSPUI submission (some of the code never made it into 1.5 codebase during my original Config Submission patch, so this feature was not working properly).

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2481 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-04 22:45:19 +00:00
Tim Donohue
faa1749a25 Ack...sorry, I updated the wrong SVN...my mistake!
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2473 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-03 18:19:46 +00:00
Tim Donohue
7aae860821 test update
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2472 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-03 18:18:22 +00:00
Graham Triggs
5ed6765f73 Centralise Thumbnail logic, and improve DB efficiency in generating thumbnail links on item lists (in testing, at least 4x better)
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2470 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2008-01-02 09:30:40 +00:00
Graham Triggs
ada69cdad8 Added "db.poolname" configuration (so that multiple applications can share a single DBCP). Also add a shutdown method to allow web applications to clean up on undeploy.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2468 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-12-29 22:19:26 +00:00
Graham Triggs
8ed598e202 Fix SF Bug: 1744488 - Mapped items listed multiple times in feeds / recent submissions
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2466 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-12-25 22:45:23 +00:00
Andrea Bollini
a581adcec6 [ 1856368 ] Patch for Bug #1856364 Wrong label for First/Last name
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2462 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-12-22 12:43:21 +00:00
Andrea Bollini
f0dad44126 [ 1856368 ] Patch for Bug #1856364 Wrong label for First/Last name
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2461 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-12-22 12:43:08 +00:00
Andrea Bollini
833bdef713 [ 1856368 ] Patch for Bug #1856364 Wrong label for First/Last name
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2460 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-12-22 12:42:46 +00:00
Graham Triggs
9237c9e5ef Fix retrieval of Locale for an EPerson so that if the language isn't set, an NPE isn't thrown
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2456 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-12-20 18:22:51 +00:00
Scott Phillips
1001bb887a (Conal Tuohy) SF# 1769052 fix URI-parsing bug in AspectGenerator
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2453 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-12-18 00:14:42 +00:00
Scott Phillips
b98479ab30 (Scott Phillips) Added top level target directory (and eclipse tomcat plugin generated directory 'work') to the ignored list.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2452 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-12-17 23:53:42 +00:00
Scott Phillips
d062e0db04 (Samu Viita) Added JSPUI-like logging of bitstreams downloads.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2451 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-12-17 23:37:29 +00:00
Scott Phillips
49e047fff4 (Scott Phillips) Cleaned up import directives
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2450 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-12-17 23:20:15 +00:00
Graham Triggs
3b4e9a778e Fix to SF bug #1827521 - recent submissions not showing sub-community submissions.
- adds communities2item table maintenance back into browse, includes new SQL to query the community hierarchy more efficiently than the Item/Community API
- by extension, fixes a problem where items in an upgraded database can't be deleted due to their existence in communities2item
- also, changes Harvest to use communities2item instead of community2item, so RSS feeds will work on the same basis of recent submissions, and include the sub-community content

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2447 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-12-16 22:41:40 +00:00
Mark Diggory
1b2178a688 Add in X509 Auth Key for xmlui
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2438 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-12-14 02:59:51 +00:00
Graham Triggs
bac57b5e0c Improved efficiency of scoped browsing by replacing an IN with an EXISTS
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2437 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-12-13 23:48:50 +00:00
Graham Triggs
08a038b17d Improve efficiency of pruning excess information from browse tables
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2436 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-12-13 23:04:59 +00:00
Mark Diggory
f7f8500155 Allow X509Authentication to be triggered from Login Choices page as well. Default is old behavior, This allows one to maintain the site under http and only protect certificate login page with https for certificate authentication. Implicit X509 Authentication is not ideal in relation to default Internet Explorer behavior.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2435 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-12-13 19:26:33 +00:00
Graham Triggs
7bd52205f6 *Massively* sped up the index prune methods (which means instatiating / withdrawing / editing items is *much* faster)
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2434 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-12-13 17:37:59 +00:00
Graham Triggs
ef4151816e Significantly speed up the submission process, by reducing the work the browse code does if it can assume that the item has never been indexed
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2432 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-12-13 15:33:53 +00:00
Mark Diggory
97694bf58a Enable METS OAI Crosswalk by default.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2421 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-12-10 21:34:12 +00:00
Mark Diggory
d3e0e07a58 correct dateCreated and dateIssued mappings in mods-submission xsl
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2420 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-12-10 21:31:39 +00:00
Graham Triggs
1f32543a19 Made a number of methods in the submission steps protected instead of private, to make it easier to extend the provided steps
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2414 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-12-03 14:30:56 +00:00
Graham Triggs
65ceafe5e2 Updated schema to remove the old browse tables that are no longer used
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2412 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-12-01 11:17:19 +00:00
Tim Donohue
e891212fdf Small addition of a "Skip" flag to MediaFilterManager/filter-media. Allows one to specific a list of identifiers (communities/collections/items) to SKIP during filtering process. Updated documentation to explain this new flag.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2410 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-30 18:14:41 +00:00
Tim Donohue
6e377ffd94 Small bug fix to MediaFilterManager (found a cast to MediaFilter rather than to new FormatFilter). Fixed some comments.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2407 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-29 17:55:45 +00:00
Graham Triggs
603b82a006 Improved browse configuration (ability to hide sort options from the browse controls, can set left-hand navigation to asc and/or desc lists). Improves normalisation of titles.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2406 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-29 11:58:05 +00:00
Graham Triggs
68bc714dfd Changed getBrowseIndices to respect order in dspace.cfg
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2400 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-28 22:34:57 +00:00
Mark Diggory
c88190c161 Add capability to filter bitstream which match a specific name.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2399 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-28 21:27:02 +00:00
Mark Diggory
25e83a7b0e New options for ItemImporter to support bitstream permissions and descriptions
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2398 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-28 21:07:34 +00:00
Graham Triggs
6c401c9e55 Fixed missing contexts to ItemCounter constructors
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2397 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-28 17:53:16 +00:00
Tim Donohue
055a30715f Removed comments which had "UIUC" in them...whoops!
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2396 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-28 16:06:58 +00:00
Tim Donohue
2afd7ffefa Applying SF patch #1589429 - "Self-Named" Media Filters (i.e. MediaFilter Plugins!)
[This original patch was modified slightly to leave the existing MediaFilter abstract class intact, 
and instead create a new FormatFilter interface which MediaFilter now implements]

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2393 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-27 22:03:24 +00:00
Stuart Lewis
133de48176 (Richard Jones) S.F. Patch 1659868 Improved database level debugging
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2392 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-27 10:02:09 +00:00
Mark Diggory
db254d753b add in missing language-packs
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2369 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-26 20:21:28 +00:00
Tim Donohue
0bfdc89689 Fixed bug in Manakin Configurable Submission flow - It was causing an infinite loop, if your first submission step was a non-interactive (i.e. no-UI) step. Also fixed a small bug to ensure that clicking "Previous" button will always bring you back to the last step you completed which had a UI.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2368 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-26 18:02:40 +00:00
Graham Triggs
3b9a53bba7 Solve problem with 404 pages leaking contexts / connections due to not being run under a servlet
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2367 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-26 13:46:35 +00:00
Graham Triggs
9f382c3438 Fixed connection / context leak in ItemCounter
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2366 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-26 11:03:40 +00:00
Graham Triggs
6326ffae55 And the update script - changed 'number' column to 'count' as number is a reserved word in Oracle
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2365 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-26 10:24:51 +00:00
Graham Triggs
54058b0aff Changed 'number' column to 'count' as number is a reserved word in Oracle
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2364 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-26 10:21:46 +00:00
Graham Triggs
3ddbccad9b Fix problems with strength counter (SQLException doesn't nest Throwable, incorrect cast of Community dso)
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2363 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-26 09:51:43 +00:00
Graham Triggs
105c772e57 More Oracle compatibility fixes - date truncation
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2362 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-26 09:10:39 +00:00
Graham Triggs
e807a057de Fix Oracle compatibility - must supply sequence value on insert
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2361 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-25 22:24:26 +00:00
Graham Triggs
80e9508ff9 Add BMP to the default list of formats read by the JPEGFilter, as it is supported in Java 5
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2359 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-25 17:25:41 +00:00
Graham Triggs
378291b327 Renamed recent.submissions.index to recent.submissions.sort-option
This is to avoid confusion with index names and sort options - also updated configuration documentation to correctly refer to sort-option and not index

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2358 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-25 13:29:44 +00:00
Graham Triggs
5aac8da542 Removed authorlinks and subjectlinks configuration, as they were no longer used following Andrea's update
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2357 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-24 23:08:54 +00:00
Graham Triggs
571351dcfd Fixed missing localizations in help links
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2356 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-23 14:14:12 +00:00
Graham Triggs
ac26ef5b64 Add ability to customise the item list display for different browse indexes and sort options
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2355 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-22 10:22:56 +00:00
Graham Triggs
a7cfd21ed1 Fixed browsing of authors in Item Mapper so that you only need to specify a partial name
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2354 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-21 12:39:54 +00:00
Mark Diggory
1642fd3bf7 Use full release versions.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2352 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-20 04:27:03 +00:00
Mark Diggory
8b6d99a327 Correction to bug discovered by Larry Stone (81906): https://webmail.mit.edu/horde/services/go.php?url=https%3A%2F%2Fsourceforge.net%2Ftracker%2F%3Ffunc%3Ddetail%26atid%3D319984%26aid%3D1834865%26group_id%3D19984
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2350 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-20 01:56:07 +00:00
Mark Diggory
0d532b146b move resolution of dspace-assembly-plugin into parent pom, correcting issues downstream in build process where it cannot be resolved.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2348 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-15 23:00:44 +00:00
Mark Diggory
08ac88062e Reinitialize Browse tables anytime IntializeDatabase is called.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2346 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-14 17:35:10 +00:00
Mark Diggory
a96e2d97f2 attach assembly back into package phase.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2345 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-13 18:46:35 +00:00
Mark Diggory
a0e8586ed7 Adjust scm location to be in the branch.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2343 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-13 01:29:37 +00:00
Mark Diggory
2001749ce0 Wrap SQLExceptions in ItemCounter with ItemCountExceptions and wrap ItemCountExceptions in Collection and Community in RuntimeExceptions.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2339 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-12 23:39:13 +00:00
Richard Jones
813ca2b557 add missing import statements in Community and Collection for item counter
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2337 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-12 16:09:33 +00:00
Mark Diggory
8fc1889d77 Add snapshot repository details to all poms so that parents can be properly resolved when individual projects are checked out.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2336 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-12 15:54:32 +00:00
Mark Diggory
a22fc9ae8d Add snapshot repository details to all poms so that parents can be properly resolved when individual projects are checked out.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2335 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-12 15:54:27 +00:00
Mark Diggory
384bdd11d2 Add snapshot repository details to all poms so that parents can be properly resolved when individual projects are checked out.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2334 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-12 15:54:24 +00:00
Mark Diggory
04eb99c09d Add snapshot repository details to all poms so that parents can be properly resolved when individual projects are checked out.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2333 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-12 15:54:18 +00:00
Mark Diggory
6fd1e2f241 Add snapshot repository details to all poms so that parents can be properly resolved when individual projects are checked out.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2332 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-12 15:54:13 +00:00
Mark Diggory
35405b8c30 Add snapshot repository details to all poms so that parents can be properly resolved when individual projects are checked out.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2331 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-12 15:54:06 +00:00
Mark Diggory
6b337b8fe1 Add snapshot repository details to all poms so that parents can be properly resolved when individual projects are checked out.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2330 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-12 15:53:58 +00:00
Richard Jones
8d7b59f45d Option to generate community and collection "strength" as a batch job
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2328 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-12 11:59:47 +00:00
Graham Triggs
8a7e41a5fe Moved CreativeCommons xsl files from java directory to resources so that they are correctly added to the JAR
(otherwise, CreativeCommons class can't be created due to missing resources in static initialisation)

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2327 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-12 10:20:27 +00:00
Mark Diggory
c966ccc19a Phase 2 of build process refactoring:
Remove obsolete dspace-pom project.

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2326 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-11 05:43:31 +00:00
Mark Diggory
bdfb2db765 Phase 2 of build process refactoring: Add capability to produce skinny wars as secondary artifacts of webapp projects.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2325 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-11 05:34:31 +00:00
Mark Diggory
661cec65f7 Adjusting generated maven website locations.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2324 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-10 22:23:21 +00:00
Mark Diggory
51cf0347e5 Phase 1 of build process refactoring.
1.) move parent pom to top level directory and change name to dspace-parent
2.) adjust parents of all weapps to be module in next directory up instead of dspace/pom.xml
3.) add in db driver selection and dspace.config selection into webapp poms.
4.) Add all child projects as modules in dspace-parent.

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2323 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-10 21:21:23 +00:00
Mark Diggory
8c970ff63e Adjust versions so build will work until these get into the central repository.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2322 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-07 22:28:38 +00:00
Scott Phillips
e82de9cb24 (Scott Phillips) Removed the geronimo java mail library which is allready explicitly provided. This prevent any action that resulted in mail being sent, such as registering a new user or submitting an item.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2321 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-07 20:21:33 +00:00
Tim Donohue
977d3cc8fb More fixes to spelling & grammar within Manakin's messages.xml.
Some of these were suggested by Dorothea Salo (U of Wisconsin).

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2320 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-07 18:25:56 +00:00
Mark Diggory
dd4473d449 license
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2319 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-07 17:31:46 +00:00
Tim Donohue
13a4855053 Fixes to spelling & grammar within Manakin's messages.xml
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2318 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-07 16:39:06 +00:00
Tim Donohue
72ad21bd50 Fixed misspelled template "standardAttribues". Renamed to "standardAttributes", and fixed all references to it.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2317 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-07 15:39:31 +00:00
Mark Diggory
24867750c9 dropping excess info logging.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2316 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-06 22:44:39 +00:00
Mark Diggory
b1df1f0d68 CreativeCommons RDF processing based on XSL Transform.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2315 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-06 22:33:58 +00:00
Mark Diggory
c305b3bbf0 CreativeCommons RDF processing based on XSL Transform.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2314 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-06 22:28:48 +00:00
Mark Diggory
e570f0bc39 CreativeCommons license cleanup CLI
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2313 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-06 22:27:50 +00:00
Graham Triggs
c46b3d9d3b Fixed generation of the Creative Commons RDF, including the parsing change for the cc namespace.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2312 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-06 12:43:56 +00:00
Mark Diggory
acfcf672f1 Correcting poor formatting in poms...
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2310 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-05 18:52:06 +00:00
Mark Diggory
3fe78f4e88 Move back to maven.dspace.org - deployment and removal of release repo def (central repo now used).
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2299 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-05 18:16:24 +00:00
Mark Diggory
e362deb21a Move back to maven.dspace.org
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2298 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-05 18:04:38 +00:00
Scott Phillips
1b9c6949c3 (Scott Phillips) Setting the .tomcat-plugin file and work/ directories used by eclipse to ignored.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2297 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-01 02:24:13 +00:00
Scott Phillips
0ccf16a338 (Scott Phillips) Setting the .tomcat-plugin file and work/ directories used by eclipse to ignored.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2296 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-01 02:24:10 +00:00
Scott Phillips
457b4419ab (Scott Phillips) Setting the .tomcat-plugin file and work/ directories used by eclipse to ignored.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2295 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-01 02:24:07 +00:00
Scott Phillips
de10d39b0b (Scott Phillips) Setting the .tomcat-plugin file used by eclipse to ignored.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2294 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-01 01:44:10 +00:00
Scott Phillips
0183c6374b (Scott Phillips) Setting the .settings directory used by eclipse to ignored.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2293 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-01 01:25:11 +00:00
Scott Phillips
12f08b2ffe (Scott Phillips) Setting the .settings directory used by eclipse to ignored.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2292 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-01 01:24:42 +00:00
Scott Phillips
d307a5bc8f (Scott Phillips) Setting the .settings directory used by eclipse to ignored.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2291 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-11-01 01:23:57 +00:00
Scott Phillips
11d58113c5 (Scott Phillips) Setting the target directory to ignored.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2288 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-31 21:55:10 +00:00
Scott Phillips
032d9ecdb5 (Scott Phillips) Setting .settings, used by eclipse, to ignored.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2287 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-31 21:54:35 +00:00
Mark Diggory
b47c404580 Correct identifier issues with repositories and switch over to using S.F. location for snapshot and release.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2286 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-30 20:20:14 +00:00
Mark Diggory
e99f6e5f4a adjust location of scm in dspace 1.5 branch.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2284 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-30 02:43:34 +00:00
Mark Diggory
fb35b49079 Adjust pluginRepositories to new locations.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2283 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-30 02:35:01 +00:00
Mark Diggory
38576313d8 Adjust versioning and snapshot location.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2282 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-30 02:19:02 +00:00
Mark Diggory
bb7247c334 uniqueVersion = false to reduce number of snapshot copies.
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2279 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-29 20:20:23 +00:00
Mark Diggory
27b2335cc4 Commiting adjustments to handle next "version"
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2277 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-29 19:40:58 +00:00
Tim Donohue
134852de5d Small bug fix to Pluggable Style Selection. If an item is still an InProgressSubmission, it will not yet have an "owning collection".
This was causing errors when attempting to preview or remove an InProgressSubmission in JSPUI.


git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2276 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-29 15:16:11 +00:00
Mark Diggory
6737f2158d Adjusting versioning to 1.5-alpha
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2273 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-25 18:10:22 +00:00
Mark Diggory
c5bae35cd9 Adjusting versioning to 1.5-alpha
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2272 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-25 18:10:16 +00:00
Mark Diggory
e20553e792 Adjusting versioning to 1.5-alpha
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2271 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-25 18:10:13 +00:00
Mark Diggory
f9fbf6a09c Adjusting versioning to 1.5-alpha
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2270 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-25 18:09:59 +00:00
Mark Diggory
f846f9bbf7 Adjusting versioning to 1.5-alpha
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2269 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-25 18:09:55 +00:00
Mark Diggory
3e5f37c74c Adjusting versioning to 1.5-alpha
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2268 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-25 18:09:51 +00:00
Mark Diggory
2540cebcaf Adjusting versioning to 1.5-alpha
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2267 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-25 18:09:48 +00:00
Mark Diggory
ded661235e Adjusting versioning to 1.5-alpha
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2266 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-25 18:09:45 +00:00
Andrea Bollini
f7a83f2a02 [1818000] Pluggable Style Selection strategy for item display
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2264 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-25 12:41:44 +00:00
Andrea Bollini
58b2bcac44 [1818000] Pluggable Style Selection strategy for item display
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2263 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-25 12:39:31 +00:00
Scott Phillips
e757a57b5b (Scott Phillips) Branch for DSpace 1.5.X set of releases
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2260 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-24 16:02:30 +00:00
Graham Triggs
8c2692ea7d Add the capability to define in which order the index should be listed by default (ascending or descending)
Also, removed two uses of 'magic' strings - replaced with static values from SortOption

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2259 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-24 11:47:31 +00:00
Graham Triggs
024ba53adf Defensive coding to avoid a FeedException when there is no description
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2258 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-23 10:34:47 +00:00
Graham Triggs
30c3a05a38 Added SQL to bring Oracle schema inline with Postgres updates
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2257 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-22 14:41:10 +00:00
Andrea Bollini
8c3b4ead62 display item page use the same configuration then browse system
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2256 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-22 14:16:33 +00:00
Richard Jones
4d1706b383 (Andre Bollini)
add null checks to dc metadata lookups in BrowseItem

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2255 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-22 12:12:51 +00:00
Andrea Bollini
1db6ad8882 more info in Exception message
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2254 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-19 16:42:53 +00:00
Andrea Bollini
140c9f25e6 added an initial configuration for webui.content_disposition_threshold (8Mb) and some info about
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2253 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-15 13:46:58 +00:00
Andrea Bollini
8d2b38eead added missed review initial question code
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2252 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-14 20:40:07 +00:00
Scott Phillips
8c12c74796 (Scott Phillips) Modify artifact preview to be more general than just thumbnails. This allows the possibility for themes to override the template to provide any icon it can for an items.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2251 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-12 22:21:37 +00:00
Stuart Lewis
5f35de8ebd (Robert Tansley) SF Patch #1566572 Item metadata in XHTML head <meta> elements
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2250 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-11 15:55:37 +00:00
James Rutherford
e303e57762 Fixed a minor bug in QDC.properties.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2249 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-11 10:53:17 +00:00
Graham Triggs
6c40b8a3b2 Fix Oracle sequence resetting
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2248 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-05 16:01:40 +00:00
Graham Triggs
2eab772d8f Corrected population of checksum_history
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2247 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-04 09:37:20 +00:00
Scott Phillips
a6d36acfcb (Scott Phillips) Setting default Manakin configuration paramaters.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2246 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-03 16:59:37 +00:00
Mark Diggory
e13f47b984 change parameter names to avoid risk of infinite loop
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2245 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-03 16:24:01 +00:00
Mark Diggory
9dcd497c56 change parameter names to avoid risk of infinite loop
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2244 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-03 16:22:42 +00:00
Mark Diggory
2d62e0fbf6 Remove dependency on Jena as the history system went away.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2243 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-03 15:30:33 +00:00
Mark Diggory
79edaa9f19 Removing bouncycastle, changing location of tm-extractors
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2242 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-03 15:08:27 +00:00
Graham Triggs
6d458762fc Corrected timestamp insertion in most_recent_checksum
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2241 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-03 14:52:24 +00:00
Graham Triggs
5a21e42fa5 Fixed definition of checksum_results
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2240 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-03 14:35:06 +00:00
Mark Diggory
fbfe181584 Use official Lucene jars in Maven repository.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2239 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-03 11:39:07 +00:00
Scott Phillips
4e5e1d0eb2 (Scott Phillips) Added a unique theme ID, which will be used by the feathers theme engine to provide easier theme development.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2238 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-03 03:15:55 +00:00
Scott Phillips
8cc1f28f56 (Scott Phillips) Added the rend attribute to xrefs, at it says they should have in the DRI schema.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2237 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-03 01:20:57 +00:00
Scott Phillips
b6bd305149 (Scott Phillips) Added the rend attribute to xrefs, at it says they should have in the DRI schema.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2236 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-03 01:17:32 +00:00
Scott Phillips
5d64526285 (Scott Phillips) Added the rend attribute to xrefs, at it says they should have in the DRI schema.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2235 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-03 01:16:11 +00:00
Scott Phillips
886ef957d6 (Scott Phillips) Fixed bug where if forced SSL for authenticated sessions is turned on and multiple authentication mechansms are installed the user would not be redirected to the proper authentication mechanisms if they were allready on a secure connection.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2234 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-03 00:42:30 +00:00
Scott Phillips
ca7d4defc9 (Scott Phillips) If a bitstream has access is restricted and the user is allready logged in instead of asking them to login again display an error page that tells the user they do not have suffecient priveleges to access the bitstream.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2233 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-03 00:13:58 +00:00
Scott Phillips
5fb0c5bbde (Scott Phillips) Tweaked default caching parameters based upon testing under live conditions at the TDL repository. The problem with the previous repository is that under even normal conditions components (i.e. transformers, generators, etc) would not be released from the cache and eventualy would suck all the available memory out of the JVM unless you had absolutely obsene amounts of available memory. Thse pramaters tweak the JVM to preform with just 64 megabytes of available memory and will always expire items from the cache after 24 hours or sooner.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2232 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-02 23:33:13 +00:00
Scott Phillips
b3d228444b (Scott Phillips) Remove the bitstream bitrange feature from downloading bitstreams. Adding this header causes some problems on the windows-based PDF viewers.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2231 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-02 23:15:23 +00:00
Scott Phillips
dc7bee8347 (Scott Phillips) Modified ItemImport so that when testing, i.e. the -t flag, each metadata field that is being added is check to see if it exists. If the field does not exist then an error message is printed, and the test continues.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2230 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-02 23:06:56 +00:00
Scott Phillips
bf971ddca1 (Scott Phillips) Removed the DSpaceResourceManager as a specific transformer to manage the opening and closing of DSpace context. Sometimes under high loads cocoon will not complete the lifecycle of transformers which would creat contitions where DSpace contexts / database connections would be leaked. To fix this the cocoon servlet wrapper is modified to handle closing ony open DSpace contexts when the servlet exits.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2229 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-02 22:26:31 +00:00
Mark Diggory
82c6717dfa sql.dir no longer a used property.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2228 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-02 20:59:22 +00:00
Mark Diggory
ecddeec8e5 Make servlet-api provided here as well.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2227 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-02 20:58:20 +00:00
Mark Diggory
16e4d90cce creating separate repositories for release and snapshot dspace dependencies.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2226 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-02 20:47:40 +00:00
Mark Diggory
05d74ee438 Adding servlet api to dspace-lni-client now that its designated as provided.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2225 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-02 17:24:34 +00:00
Mark Diggory
c4babb5a7d Adding servlet api to dspace-lni now that its designated as provided.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2224 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-02 17:10:15 +00:00
Mark Diggory
9f89b31db3 Adding servlet api to dspace-oai now that its designated as provided.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2223 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-10-02 17:08:27 +00:00
Graham Triggs
72cceaf478 Mark servlet-api dependency as provided (by application container)
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2222 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-29 20:43:22 +00:00
Graham Triggs
f9bdb78071 Added initialisation code to avoid file locking problems on windows
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2221 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-29 20:42:25 +00:00
Graham Triggs
a85b083e75 Added servlet-api dependency to resolve compilation problem
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2220 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-29 20:34:44 +00:00
Graham Triggs
4a194fa770 Fixed compilation error
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2219 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-29 20:19:28 +00:00
James Rutherford
6e35504357 (Chris yates)
- SF Patch #1759438 Multilingualism Language Switch - DSpace Header (updated to be compatible with new browse & submission systems).

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2218 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-28 13:17:04 +00:00
Claudia Juergen
fe2b7fd5d0 Removed reference to TxSpace
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2217 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-27 10:41:51 +00:00
Claudia Juergen
e7ce357377 Typo in xmlui.dri2xhtml.structural.contact-link
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2216 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-27 09:24:59 +00:00
James Rutherford
9ead74b923 Fixed a bug in RDFCrosswalk (it threw an NPE if an item didn't have any thumbnails).
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2215 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-26 09:44:36 +00:00
Graham Triggs
961d03ea33 Fix itemRemoved method to correctly clear entries from the general item / withdrawn item tables.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2214 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-24 20:35:21 +00:00
Graham Triggs
c39aa5b780 Always make item removal update the browse tables (may have entries in 'admin' tables).
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2213 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-24 20:17:11 +00:00
Stuart Lewis
e42cb88744 (Stuart Lewis) SF Patch #1799575 New EPersonConsumer event consumer
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2212 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-21 13:48:48 +00:00
Graham Triggs
aeab047b6e Repaired invalid character from i18n patch
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2211 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-21 04:32:57 +00:00
Graham Triggs
74dbc81a42 Fixed include of authentication classes following package move
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2210 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-20 22:01:22 +00:00
Stuart Lewis
567a726316 git-svn-id: http://scm.dspace.org/svn/repo/trunk@2209 9c30dcfa-912a-0410-8fc2-9e0234be79fd 2007-09-20 15:24:32 +00:00
Claudia Juergen
4a85015b9c (Brian Helm)
SF Patch 1794700  Bug fix for stat-monthly and stat-report-monthly

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2208 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-19 14:46:50 +00:00
Claudia Juergen
93e46412bb (Brian Helm)
SF Patch 1794700  Bug fix for stat-monthly and stat-report-monthly

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2207 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-19 14:45:54 +00:00
Claudia Juergen
70ddde04db Galician Translation of Messages.properties based on DSpace 1.4.2
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2206 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-19 12:02:55 +00:00
Graham Triggs
bcf7cc64a5 Fix a 'starts with' browsing bug
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2205 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-18 16:13:17 +00:00
Mark Diggory
bf4d523f18 These projects will become available in 1.6 and will not be used in 1.5.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2204 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-18 15:56:01 +00:00
Mark Diggory
84589147ff restore "file:" scheme on log4j prarameters.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2203 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-18 04:17:21 +00:00
Mark Diggory
a66fd04fb5 typo
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2202 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-18 03:35:40 +00:00
Mark Diggory
a01d03d89f disable logging so log4j can log to console properly.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2201 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-17 18:56:23 +00:00
Mark Diggory
08d4b0c908 Hardwire initialization and destruction of Browse tables into IntializeDatabase.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2200 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-17 18:44:55 +00:00
Mark Diggory
c9561398b0 .Use current Ant/Java approach for database initialization and registry creation
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2199 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-17 18:43:32 +00:00
Graham Triggs
a9225f6022 Added ability to specify a character set to be used when sending an email. Can be set as a default value in dspace.cfg, or (overridden) by an email template by specifying a charset: line.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2198 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-17 15:39:36 +00:00
Graham Triggs
6a90077cb1 Ensure that the item is in the archive and eligible for indexing before adding it to Lucene
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2197 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-17 15:38:10 +00:00
Graham Triggs
800a77bfe1 Added getPoliciesForGroup method, updated API to make use of Java 5 syntax
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2196 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-13 15:15:09 +00:00
Mark Diggory
fb1e307117 Correct issues with invalid mods content generation.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2195 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-10 20:59:26 +00:00
Mark Diggory
ea52e2c1e0 reinsert assembly:assembly call
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2194 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-10 03:02:36 +00:00
Mark Diggory
d720a48c32 correct postgres dependency
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2193 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-08 16:46:29 +00:00
Mark Diggory
912516b126 Reinsert dspace/pom.xml into dependency hierarchy and move database dependencies downstream.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2192 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-08 14:26:30 +00:00
Mark Diggory
553c915626 Reinsert dspace/pom.xml into dependency hierarchy and move database dependencies downstream.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2191 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-08 14:20:40 +00:00
Mark Diggory
f98c875d14 More reasonable defaults for testing.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2190 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-07 19:09:49 +00:00
Mark Diggory
0a051502aa Minor name change.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2189 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-07 19:04:04 +00:00
Mark Diggory
99e5a0b313 Moving database driver config and dspace config downstream to dspace/pom.xml
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2188 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-07 16:26:50 +00:00
Mark Diggory
2f5fd4bfd3 package hierarchy for sql files
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2187 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-07 16:02:15 +00:00
Mark Diggory
5bb74802a6 Correct artifact name.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2186 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-06 19:08:26 +00:00
Mark Diggory
89b4fe7ced Initial checkin of the dspace-storage-oracle addon to support all things Oracle
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2185 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-06 18:57:36 +00:00
Mark Diggory
28dc14ef02 Share project 'dspace-storage-oracle' into 'https://dspace.svn.sourceforge.net/svnroot/dspace'
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2184 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-06 18:56:37 +00:00
Mark Diggory
6705365605 Initial checkin of the dspace-postgres-storage addon to support all things Postgres.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2183 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-06 18:55:59 +00:00
Mark Diggory
51d19e12c6 Share project 'dspace-storage-postgres' into 'https://dspace.svn.sourceforge.net/svnroot/dspace'
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2182 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-06 18:54:20 +00:00
James Rutherford
fa2fcea6b5 Fixed a minor bug in the SubmissionConfigReader constructor
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2181 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-06 17:09:35 +00:00
Claudia Juergen
90796abf55 Updated German Translation to revision 2171 of Messages.properties
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2180 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-06 13:39:50 +00:00
Mark Diggory
a90289e324 Add in jdbc driver url
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2179 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-04 03:22:29 +00:00
Mark Diggory
5813c372e9 Correcting web.xml in xmlui to support initializing DSpace in the application.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2178 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-04 02:44:49 +00:00
Mark Diggory
729bfb9a86 Correcting web.xml in xmlui to support initializing DSpace in the application.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2177 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-09-04 02:44:24 +00:00
Mark Diggory
7fedefef06 correcting some minor mistakes in previous commit.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2176 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-31 05:17:56 +00:00
Mark Diggory
ceb1f5b020 Migrating database selection criteria to maven profiles.xml. Includes:
1.) profiles-example.xml that can be copied to profiles.xml as an example
2.) adjustements to poms to support usage of profiles to overide properties.
3.) svnignore to assure profiles.xml isn't managed in svn.

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2175 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-31 05:14:11 +00:00
Graham Triggs
4f7b5c8424 Fixed metadata mapping so that it can export metadata items that contain a dollar sign!
Also added extra protection for items without bitstreams.

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2174 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-30 11:10:07 +00:00
Graham Triggs
4b3599386c Added copyright comments.
(that's the problem with code folding them out of the way - you don't notice when they are missing

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2173 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-28 15:59:28 +00:00
Stuart Lewis
c5d0ca8979 SF Patch 1743188 Patch for Request #1145499 - Move Items - fixing small code formating mistake
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2172 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-28 15:54:08 +00:00
Stuart Lewis
a4c696de8c SF Patch 1743188 Patch for Request #1145499 - Move Items
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2171 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-28 15:05:50 +00:00
Stuart Lewis
0ab5d3bad4 SF Patch #1591871 Docs for google and html sitemaps
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2170 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-28 11:05:15 +00:00
Stuart Lewis
d7de5c47fa Updated configure help doc to reflect new package (org.dspace.authenticate)
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2169 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-28 06:25:27 +00:00
Robert Tansley
311eb7ae28 (Robert Tansley / Barhatov Andrew)
- Authentication code moved to new org.dspace.authenticate package
- Added IP Authentication (SF patch #1566820).


git-svn-id: http://scm.dspace.org/svn/repo/trunk@2168 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-27 22:40:09 +00:00
Mark Diggory
0b1664c114 remove usage of apache snapshot repository.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2167 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-26 03:20:07 +00:00
Mark Diggory
3dd9ca2fe7 1.) Add in filtering by dspace.config (inherited by all children of the parent pom).
2.) open repostory updates to be once daily.
3.) Add documentation about various configurations.

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2166 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-25 20:46:52 +00:00
Mark Diggory
c7c6efd432 Organize Imports.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2165 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-25 04:32:57 +00:00
Mark Diggory
5178afaabe Cleanup for loops and collections.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2164 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-25 04:31:17 +00:00
Mark Diggory
62a5122f6e 1.) Adding null pointer guards against collections being null
2.) Improving logic of Browse and Search consumers because both API support the same method for both the update and add of items and internally manage decisions about the appropriateness of the item to be indexed.

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2163 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-25 04:18:03 +00:00
Mark Diggory
b3cc5dffd2 Removing Async configuration which will be provided in addon.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2162 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-24 22:40:26 +00:00
Graham Triggs
aa8f711055 Individual indexItem / itemRemoved additionally call prune methods at the end to ensure that excess data is removed from the browse indeces.
The batch reindex process does *not* prune until the end of execution.

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2161 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-24 21:51:04 +00:00
Graham Triggs
958a45faf9 Adds xmlui interface to withdrawn item browser. Fixes a minor issue in the BrowseEngine.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2160 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-24 16:09:08 +00:00
Claudia Juergen
ce93f942cb Welsh language pack
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2159 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-24 10:01:23 +00:00
Stuart Lewis
6736b6c2d7 SF Patch #1720105 Add SMTP port as configurable parameter
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2158 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-23 13:04:07 +00:00
Stuart Lewis
c2a5c1f564 SF Patch #1720105 Add SMTP port as configurable parameter
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2157 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-23 13:00:25 +00:00
Stuart Lewis
a87167901f Updated with two recent patches - #1737792 #1724330
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2156 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-23 12:33:27 +00:00
Stuart Lewis
6c2a7ff2c1 [ 1724330 ] Removes "null" being displayed in community-home.jsp
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2155 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-23 11:18:26 +00:00
Stuart Lewis
b6c6e4ecf8 [ 1724330 ] Removes "null" being displayed in community-home.jsp
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2154 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-23 11:17:57 +00:00
Stuart Lewis
1d045ca3d4 [ 1737792 ] Patch for bug 1552760 - Submit interface looks bad in Safari (+ removal of message for Netscape users in choose-file.jsp + removal of supporting text and images in the help file)
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2153 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-23 10:55:13 +00:00
Stuart Lewis
172b421ef9 [ 1737792 ] Patch for bug 1552760 - Submit interface looks bad in Safari (+ removal of message for Netscape users in choose-file.jsp + removal of supporting text and images in the help file)
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2152 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-23 10:54:42 +00:00
Mark Diggory
fb7d827091 Correct log4j typo.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2151 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-22 20:17:09 +00:00
Mark Diggory
7eb5995011 Cleanup/Clarify Commandline options for 1.5.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2150 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-22 04:05:18 +00:00
Tim Donohue
38ac17aaed Added functionality to allow the User Interface to determine which item-submission.xml to use for Configuration Submission.
- There are still two item-submission.xml files:  item-submission-JSPUI.xml and item-submission-XMLUI.xml
 - Now, the JSPUI will automatically load item-submission-JSPUI.xml, and the XMLUI will load item-submission-XMLUI.xml
 - Also updated doc/submission.html to inform users how this works
 - Updated some various comments, and updated error messages to report the item-submission.xml which caused the error

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2149 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-21 16:23:21 +00:00
Mark Diggory
fe1b824f6a adjust parent project so its source resolves in continuum.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2148 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-21 03:15:55 +00:00
Graham Triggs
83d64cf139 Improve functionality/layout of withdrawn items list
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2147 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-20 23:06:09 +00:00
Mark Diggory
44e4a632d6 Correcting mistake in earlier commit
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2146 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-20 18:43:33 +00:00
Mark Diggory
9bca17fd9d 1.) Improve options for configuring log4j so that individual log4j properties files can be selected in the configuration and/or easily overriden.
2.) Eliminate separate intialization of log4j in xmlui because ConfigurationManager is responsible for it.

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2145 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-20 14:13:55 +00:00
Graham Triggs
4d3985d466 Fixed browse index for withdrawn items. Moved DB access from BrowseItem into a DAO. Added jsp interface for browsing withdrawn items.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2144 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-19 21:25:58 +00:00
Mark Diggory
009e066a5f If the projects parent is only gotten from the repo, need to include the repo location to resolve it.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2143 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-16 19:26:09 +00:00
Mark Diggory
e99104f554 use classpath resources instead of old method.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2142 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-16 00:16:20 +00:00
Mark Diggory
81a1b6fc68 Add example xmlui.xconf file to configuration.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2141 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-16 00:09:09 +00:00
Mark Diggory
fd282cbfa1 svn-ignore .classpath and .project
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2140 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-15 20:21:20 +00:00
Mark Diggory
8ff63e9eaf Adding generated LNI classes so that application can compile in Eclipse on first checkout.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2139 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-15 20:17:00 +00:00
Mark Diggory
5135f56945 Adding generated LNI classes so that application can compile in Eclipse on first checkout.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2138 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-15 20:15:54 +00:00
Mark Diggory
4c5da605d8 git-svn-id: http://scm.dspace.org/svn/repo/trunk@2137 9c30dcfa-912a-0410-8fc2-9e0234be79fd 2007-08-15 20:12:18 +00:00
Mark Diggory
a17c147851 svn-ignore .classpath and .project
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2136 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-15 20:09:53 +00:00
Mark Diggory
95dafaf596 Use dspace-pom for parent, without relative reference.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2135 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-15 20:08:19 +00:00
Mark Diggory
5d4bb55fc6 Use dspace-pom for parent, without relative reference.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2134 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-15 20:04:47 +00:00
Mark Diggory
ec7deb7bc9 Correct assembly of wars.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2133 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-15 20:01:04 +00:00
Mark Diggory
a69e83693d Adding in support to build submodules of XMLUI and LNI when checked out at same level as other modules (I.E. to support Eclipse).
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2132 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-15 15:39:31 +00:00
Mark Diggory
f83a3bb0f9 Correct line delimiters.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2130 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-10 16:16:29 +00:00
Mark Diggory
92c7b97989 correct compilation error
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2129 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-10 16:10:28 +00:00
Mark Diggory
44d011344f Correct line delimiters.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2128 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-10 16:02:30 +00:00
Mark Diggory
639d1e0627 Correct line delimiters.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2127 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-10 15:54:35 +00:00
Graham Triggs
326be22de0 Refactored browse patch. Improves performance / reduces db overhead by only have one table for all 'item' browses (with columns for different sorting options).
All sorting options are available on *all* 'item' browses - at the top level, changing a ie. from title to issue date, will make all corresponding UI hints follow.
Also, maintains a separate table of all withdrawn items. This is currently not exposed in the UI, but can be easily (it's a current feature request).

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2126 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-09 19:43:23 +00:00
Graham Triggs
b430ce75a7 Metadata Exporter (Implements request: #1444364).
Also, consolidates the schema namespace registry into the schema type xml, with single import step.

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2125 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-08 11:34:59 +00:00
Graham Triggs
401df0ec30 SF Patch 1740579 - Patch for bug 1740454 (Concurrency)
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2124 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-07 23:22:09 +00:00
Graham Triggs
ce443e40bc More stable metadata import (SFP 1670093). Also:
- fix database_schema.sql errors (Postgres).
 - fix browse index ant task

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2123 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-07 22:54:53 +00:00
Mark Diggory
8449d51050 The didl UUID functionality is only used by the DIDL OAI crosswalk, 1.6 will utilize default java UUID support, moving this into OAI to assure it is not used similarly in the core.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2122 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-06 17:39:43 +00:00
Mark Diggory
b881c7e13a Adding in validation against dtd for submission configuration files. Correcting inputforms.dtd to support schema and vocabulary.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2121 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-06 17:31:12 +00:00
Mark Diggory
ad59c4bcca Move support for log4j console and dtds out of etc. These are better off being next to the other similar files and/or made available to xml editors.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2120 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-06 17:16:59 +00:00
Mark Diggory
5b69ba619c Move support for log4j console and dtds out of etc. These are better off being next to the other similar files and/or made available to xml editors.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2119 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-06 17:16:19 +00:00
Mark Diggory
aac785370a Move support for log4j console and dtds out of etc. These are better off being next to the other similar files and/or made available to xml editors.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2118 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-06 17:16:03 +00:00
Graham Triggs
f8667ff13f Fix missing ICU dependency for browse code
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2117 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-06 14:50:42 +00:00
Mark Diggory
97d189b828 This is a merge back to trunk of Graham Triggs work to port Configurable Browse to Manakin from the sandbox.
grahamtriggs | 2007-08-01 11:55:51 -0400
  Added IBM ICU dependency
  First attempt at integrating the configurable browse patch
  First attempt at integrating the UI changes for Configurable Browse
  Configurable browse patch - web.xml
  Java code modifications from Configurable Browse patch
  JSP changes from the Configurable Browse patch
  Removed browse changes that should have been committed to the browse branch
  Documentation, config and scripts for configurable browse
  Re-adding Configurable Browse changes following merge
  Messages for the configurable browse
  Fixed use of DCDate for i18n patch
  First attempt to make xmlui compatible with the new BrowseIndex, although not fully use the configuration
  First attempt to make xmlui compatible with new Browse API. Browse basically works, but it's more costly than needs be (unnecessary Item.find()), and only works if you use the default Browse configuration.  
  Fixed problem with second level browse (items for author / subject)
  Updates xmlui components to handle BrowseItem DSOs, ArtifactBrowser now passes these directly. r407@libaxis1:  grahamtriggs | 2007-08-06 09:14:05 -0400
  Minor fixes to make class easier to use
  Fix to only display sort by options on a second level browse
  Updates the ArtifactBrowser, to replace all browse functionality with entirely customisable browse code
  Update the browse index creation on fresh_install
  Fixed problem with indexing non-archived items
  Added caching support (key generation / validity)
  Moved internal class to bottom of file
  Browse code changes
 


git-svn-id: http://scm.dspace.org/svn/repo/trunk@2116 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-06 14:39:38 +00:00
Graham Triggs
abd590081f Removed processing / postProcessing call from doPreProcessing (caused two Items to be created per submission)
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2115 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-06 13:53:21 +00:00
James Rutherford
8d21494e13 Fixed line endings
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2114 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-05 10:38:39 +00:00
Graham Triggs
bbde6d286b Added missing page_reached column for Configurable Submission
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2113 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-08-03 12:19:33 +00:00
Mark Diggory
162ec97882 Use stable version of assembly plugin, some users having problems resolving snapshots.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2110 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-31 16:35:20 +00:00
Mark Diggory
1608c50628 (Flavio Botelho)
- S.F. Patch 1764069 Replaces "String" with "Integer" in PreparedStatement 
  Parameters where appropiate. (Added deleteByValue as another case where change is neccessary).

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2109 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-31 03:14:18 +00:00
Mark Diggory
dab5e6ecb9 Organize Imports to remove unneeded imports and expand *'s.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2108 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-30 17:26:50 +00:00
Graham Triggs
d889cec26c Fixed profile activation, split for all modules, updated comments
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2107 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-28 18:42:43 +00:00
Graham Triggs
8070702d22 Remove leftover property activations that sometimes cause problems
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2106 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-27 20:56:28 +00:00
Graham Triggs
2d7156ef18 Changes to profile activation, and initial effort to move legacy ant tasks into Maven
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2105 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-27 16:11:19 +00:00
Mark Diggory
234445252c Correction in formating.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2104 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-27 15:54:35 +00:00
Graham Triggs
da82e15a43 Fixes to ConfigurationManager
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2103 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-27 15:54:15 +00:00
James Rutherford
f6eef44817 (James Rutherford)
- Removed unnecessary and unused edu.mit.dspace.MITSpecialGroup


git-svn-id: http://scm.dspace.org/svn/repo/trunk@2102 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-27 14:50:00 +00:00
Graham Triggs
adbdf9cf54 Removing accidental commit of dspace.cfg.initial
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2101 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-27 12:03:42 +00:00
Graham Triggs
288b8648f4 Added Graham Triggs to developer list
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2100 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-27 10:50:47 +00:00
Mark Diggory
335f9511f8 changes.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2098 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-25 17:20:04 +00:00
Mark Diggory
2834ce7642 Guard against output invalid unqualified Dublin Core.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2095 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-25 16:54:48 +00:00
Graham Triggs
98fc9b8786 S.F. Patch 1679972 OAIDCCrosswalk NPE and invalid character fix
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2094 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-25 16:09:22 +00:00
Graham Triggs
aadd02c274 S.F. Patch 1679972 OAIDCCrosswalk NPE and invalid character fix
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2093 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-25 16:03:57 +00:00
Graham Triggs
17913eb318 git-svn-id: http://scm.dspace.org/svn/repo/trunk@2092 9c30dcfa-912a-0410-8fc2-9e0234be79fd 2007-07-25 13:49:01 +00:00
Graham Triggs
1ae8d57367 git-svn-id: http://scm.dspace.org/svn/repo/trunk@2091 9c30dcfa-912a-0410-8fc2-9e0234be79fd 2007-07-25 13:48:55 +00:00
Graham Triggs
806ad1b131 SF Patch 1749196 Oracle compatibility for Bitstream Checker
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2089 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-24 15:11:41 +00:00
Graham Triggs
c5b1b46924 SF Patch 1749196 Oracle compatibility for Bitstream Checker
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2088 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-24 15:11:22 +00:00
Tim Donohue
bba752c819 I realized I forgot to update the CHANGES document last week when I added the Configurable Submission to trunk :)
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2087 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-24 14:16:54 +00:00
Scott Phillips
a510d007a8 (Scott Phillips) Removing un-used package/directory
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2086 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-23 14:42:51 +00:00
Scott Phillips
8b6c0fc219 (Scott Phillips) Removed un-used DIMDisseminationCrosswalk. This was used in previous version of Manakin, and it is still usefull because it is a SAX-based crosswalk which that scales nicely. Perhaps later it could be refactored back into standard crosswalks mechanism for DSpace if DSpace ever sports SAX based crosswalks.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2085 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-23 14:41:30 +00:00
Scott Phillips
b56678be8c (Scott Phillips) Removed un-used DIMDisseminationCrosswalk. This was used in previous version of Manakin, and it is still usefull because it is a SAX-based crosswalk which that scales nicely. Perhaps later it could be refactored back into standard crosswalks mechanism for DSpace if DSpace ever sports SAX based crosswalks.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2084 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-23 14:40:00 +00:00
Scott Phillips
60fa6de7d5 (Jay Paz) Fixed incorrect import's for EPerson related classes.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2083 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-23 13:59:57 +00:00
Tim Donohue
574da36a0b Updated XML-UI with Configurable Submission code:
- Updated the existing Submission Aspect so that it supports the Configurable Submission
- Updated all of the existing Submission Step Transformers to work with Configurable Submission

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2082 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-20 20:54:39 +00:00
Tim Donohue
5630e097e6 Added JSP-UI changes for the Configurable Submission:
- Updated all submit/ JSPs
- Removed old SubmitServlet
- Added a new SubmissionController to manage submission process
- Added JSP specific processing classes to org.dspace.app.webui.submit.step.*

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2081 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-20 20:52:58 +00:00
Tim Donohue
58eba9f179 Added the Configurable Submission configuration file and docs:
- New configuration files: item-submission.xml (JSP-UI) and item-submission-XMLUI.xml (XML-UI)
- Updated the database schema
- Updated documentation for the Configurable Submission (esp. submission.html)


git-svn-id: http://scm.dspace.org/svn/repo/trunk@2080 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-20 20:50:41 +00:00
Tim Donohue
242d0ff146 Added the base Configurable Submission code to dspace-api. This includes updates to the following:
- Added a new "list" type to the input-forms.xml, which will allow you to display metadata options in radio buttons or checboxes
- Added the base Configurable Submission step processing classes (org.dspace.submit.step.*) which perform all processing for both the JSP-UI and XML-UI
- Added the classes which read the configuration file (item-submission.xml)


git-svn-id: http://scm.dspace.org/svn/repo/trunk@2079 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-20 20:49:01 +00:00
Mark Diggory
38382014b6 Remove Older HistoryManager which is no longer called in code. (Part of Event System Changes).
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2078 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-20 20:02:53 +00:00
Mark Diggory
1bbebf4026 [ 1633596 ] Event System for DSpace 1.5 CHANGES
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2077 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-20 16:12:17 +00:00
Mark Diggory
cc2313bd3c Merging in DSpace Event Mechanism Branch
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2076 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-19 19:40:48 +00:00
Mark Diggory
9871cadf7e Merging in DSpace Event Mechanism Branch
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2075 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-19 19:40:27 +00:00
Mark Diggory
b835f46d7d Merging in DSpace Event Mechanism Branch
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2074 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-19 19:40:11 +00:00
Mark Diggory
e8b21b6760 Chages addapted from: S.F. Patch 1751638 Set http disposition header to force download of large bitstreams
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2073 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-19 16:45:10 +00:00
Mark Diggory
710781b796 Comments and Formating corrections.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2072 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-19 16:08:14 +00:00
Mark Diggory
d33dae1210 activate all profiles by default, if you want to exclude a feature, select the profiles you wish to have active with 'mvn -Poai,jspui,your_profile_here package'
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2071 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-17 23:21:47 +00:00
Mark Diggory
c289644ce4 Add in our new DSpace I18N report plugin to generate an I18N report on the Messages.properties in the site documentation.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2069 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-13 21:18:54 +00:00
Mark Diggory
76f2e1df07 DSpace Logo and Add XMLUI and LNI into Navigation.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2068 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-13 16:06:32 +00:00
Mark Diggory
3962d7e77e This change is to invert our dependency on language packs so we can access dspace-api and Messages.properties during maven compilation and run custom reports to evalauate Messages.properties entries against the translations.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2067 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-12 22:26:10 +00:00
Mark Diggory
36fae591f1 Restoring ASCII properties files from svn history.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2066 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-12 19:59:07 +00:00
Mark Diggory
5a4d85ce36 example default vhost configuration file for Tomcat 5.5 or greater.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2065 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-11 19:00:57 +00:00
Mark Diggory
711e5ebe40 svn:ignore .classpath and .project files
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2064 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-11 18:59:19 +00:00
Mark Diggory
91c5d7d6f2 restore dependencies that are required to package a wing distribution as it is not dependent on dspace-api (but this still uses dependencyManagement upstream in dspace-pom to determine versions).
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2063 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-11 18:57:35 +00:00
Mark Diggory
b1c4e6421c correct for presence of lang, which is absent as a dependency due to the fact that this addon has no dependency on dspace-api
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2062 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-11 18:50:58 +00:00
Mark Diggory
ad19d3e86c Add dspace.dir into web.xml for later filtering.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2061 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-11 07:16:18 +00:00
Mark Diggory
f7513fb8a6 1.) Remove dspace.configuration filtering from Maven build process.
2.) refine versions of dependencies shared across project via dependencyManagement in dspace-pom project.
3.) refine versioning across projects that share dspace-pom. version is inherited from parent and dependencies to dspace-xx projects are bound to current version defined in dspace-pom.


git-svn-id: http://scm.dspace.org/svn/repo/trunk@2060 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-11 07:15:23 +00:00
Mark Diggory
f0bbed9424 Remove configuration from assembly stage. Provide configuration filtering of web.xml's and dspace.dir/config in a ant build.xml for the time being.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2059 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-11 07:02:26 +00:00
Mark Diggory
94b3f8eb59 provide configuration filtering of web.xml's and dspace.dir/config in a ant build.xml for the time being.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2058 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-11 06:59:15 +00:00
Scott Phillips
969ae84461 (Alexey Maslov)
- Updated the metadata handlers
  * MODS and DC now can handle the virtual object store changes
  * XSL templates across all handlers have been broken down into smaller components
  * Created a generic handler for all METS sections that are metadata-agnostic (like the fileSec secion)

- Refactored the themes according to recommended best practices for theme development  

- Fixed a bug in the item and container adapters to handle non-DIM metadata types

- Added the XSI namespace declaration to the abstract adapter

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2057 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-11 01:53:54 +00:00
Scott Phillips
5b0a13bd73 (Alexey Maslov)
- Updated the metadata handlers
  * MODS and DC now can handle the virtual object store changes
  * XSL templates across all handlers have been broken down into smaller components
  * Created a generic handler for all METS sections that are metadata-agnostic (like the fileSec secion)

- Refactored the themes according to recommended best practices for theme development  

- Fixed a bug in the item and container adapters to handle non-DIM metadata types

- Added the XSI namespace declaration to the abstract adapter

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2056 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-11 01:52:46 +00:00
Mark Diggory
c9d6ffe546 1.) rename project slightly
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2055 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-11 00:14:22 +00:00
Mark Diggory
6ea6175b13 Adjust site deployment and scm locations.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2054 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-11 00:13:04 +00:00
Mark Diggory
33577af1b3 1.) rename project slightly
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2053 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-11 00:07:42 +00:00
Mark Diggory
d105e74102 1.) rename project slightly
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2052 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-11 00:05:41 +00:00
Mark Diggory
4454dd570c 1.) correct parent inheritance
2.) rename project slightly

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2051 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-11 00:03:51 +00:00
Mark Diggory
4b2d88b874 1.) remove odd rename of war file (doesn't commute to name of war in packager).
2.) rename project slightly

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2050 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-11 00:01:06 +00:00
Scott Phillips
4eb0e5615d (Scott Phillips) Set Maven's target directories to be ignored for each of the Manakin projects.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2049 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-09 21:19:58 +00:00
Robert Tansley
5d3ea7fae4 Commented out Disallow: /browse-title; if an installation does not use sitemaps, they would not get indexed at all.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2048 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-09 17:05:24 +00:00
Richard Jones
c3bda443e3 update web.xml to use oai specific configuration loader
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2047 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-09 16:38:07 +00:00
Richard Jones
f9a93bc655 oai specific configuration loader; just a wrapper for the usual config loader for this web app
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2046 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-09 16:37:36 +00:00
Scott Phillips
fde5c09d41 (Scott Phillips) Adding Manakin, version 1.1, to DSpace. This new cocoon-based interface utilizes XML and XSLT to provide interface themability for specific community and collections while also providing interface level modularity thruogh the use of Manakin aspects.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2045 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-07 00:02:39 +00:00
Scott Phillips
b4399e950a (Scott phillips) Moved the DCInput, DCInputSet, and DCInputReader utility classes out of the JSPUI and into a generalized utility package for any dspace application. This is needed because Manakin also uses these classes.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2044 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-06 23:59:33 +00:00
Mark Diggory
0c7bdff878 Guarding Community and Collection names from causing NPEs in DSIndexer when null.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2042 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-06 02:03:07 +00:00
Mark Diggory
c2590feb4a Correct comments.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2041 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-02 20:43:06 +00:00
Mark Diggory
2f8b96b94d Templates are transformed at compile time in Maven.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2040 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-07-02 20:41:19 +00:00
Mark Diggory
09a9c7f99a Bringing LNI service into the trunk
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2039 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-28 02:46:33 +00:00
Mark Diggory
de4a138b38 Correct paths to scm and project website
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2038 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-27 17:09:27 +00:00
Mark Diggory
14f42f898c further tuning assembly to support transitive evaluation of dependencies and correct issue with war extension and deployment.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2037 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-27 17:07:37 +00:00
Mark Diggory
95c8f11128 Correct paths to scm and project website
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2036 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-27 17:05:46 +00:00
Mark Diggory
10f515f173 Correct paths to scm and project website
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2035 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-27 17:04:16 +00:00
Mark Diggory
0f546fb2f7 Correct paths to scm and project website
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2034 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-27 17:02:18 +00:00
Mark Diggory
2ef9ebcacf Correct paths to scm and project website
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2033 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-27 17:01:27 +00:00
Mark Diggory
4b923302a5 Maven Site Generation Improvements.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2032 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-27 16:39:04 +00:00
Mark Diggory
096c26052d The previous commit was a mistake, this rolls back that change. Collections and communities must be removed from their parent by classes external to the content package.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2031 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-27 00:26:58 +00:00
Mark Diggory
017441f214 Setting delete methods to be public so they can be called by code outside the content package.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2030 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-27 00:08:16 +00:00
Mark Diggory
f6a4425e9d Build.xml is now under src/main/config and deployed into the generated distribution by the maven assembly.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2029 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-26 21:06:11 +00:00
Mark Diggory
785d21ddc1 Placing build.xml here where it will be deployed into the generated distribution.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2028 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-26 02:11:38 +00:00
Mark Diggory
90a490b836 new location distribution build.xml
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2027 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-26 02:10:14 +00:00
Mark Diggory
7d89510d37 Retract previous commit of Eclipse project files.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2026 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-21 19:33:17 +00:00
Mark Diggory
695f1a1470 Retract previous commit of Eclipse project files.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2025 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-21 19:32:23 +00:00
Mark Diggory
67456258f3 Retract previous commit of Eclipse project files.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2024 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-21 19:31:09 +00:00
Mark Diggory
0f0d154df4 Retract previous commit of Eclipse project files.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2023 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-21 19:29:16 +00:00
Mark Diggory
978ecf206d Retract previous commit of Eclipse project files.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2022 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-21 19:28:15 +00:00
Mark Diggory
abf16cc00b Retract previous commit of Eclipse project files.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2021 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-21 19:26:13 +00:00
Mark Diggory
3dba86e80f Configuration filtering is now completed in Maven "Assembly" packaging.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2019 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-18 17:26:04 +00:00
Mark Diggory
57670aadd0 Assemble in appropriate dspace config designated in configuration.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2018 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-18 17:19:58 +00:00
Mark Diggory
57312a97ce Adding project files to ease developer setup in Eclipse.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2017 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-18 17:08:17 +00:00
Mark Diggory
11c67cdfa1 Remove unused imports.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2016 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-18 16:57:48 +00:00
Claudia Juergen
78f9f47048 (Jordi Prats)
- SF patch 1693412
Corrected some faults in the Spanish Messages 

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2015 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-18 07:36:15 +00:00
Mark Diggory
df2442adba UIUtil package name error
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2014 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-14 19:18:21 +00:00
Mark Diggory
82ae5ccdfd RDF Crosswalk supplied by patch: [ 1638892 ] OAI Crosswalk for DWell UI. (this does not include the dwell ui)
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2013 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-14 19:00:31 +00:00
James Rutherford
4c4b57d172 (James Rutherford)
- SF Patch #1620700 Add Community and Sub-Community to OAI Sets


git-svn-id: http://scm.dspace.org/svn/repo/trunk@2012 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-13 08:23:34 +00:00
James Rutherford
d415f88751 (James Rutherford)
- SF Patch #1638569 for SF Bug #1638565 Database Upgrade 12 to 13 missing content on new colums


git-svn-id: http://scm.dspace.org/svn/repo/trunk@2011 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-13 07:54:39 +00:00
James Rutherford
e6921c0343 (James Rutherford)
- Fixed SF bug #1614546 get rid of unused mets_bitstream_id column

Fresh installs will no longer create this unused column, and the 1.4 -> 1.5
updater script will remove the column if it exists.



git-svn-id: http://scm.dspace.org/svn/repo/trunk@2009 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-12 18:13:51 +00:00
Mark Diggory
740e9e5319 remove lang pack tasks from script
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2008 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-08 16:16:59 +00:00
Mark Diggory
440a1e2ed9 really need to maintain relative location of dspace-pom parent.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2007 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-08 12:38:10 +00:00
Mark Diggory
a3af7aee9b add maven.dspace.org as a plugin repo
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2006 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-08 12:34:26 +00:00
Mark Diggory
e72970423a really need to maintain relative location of dspace-pom parent.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2005 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-08 12:26:19 +00:00
Mark Diggory
fd58d0133d Share project 'dspace-pom' into 'https://dspace.svn.sourceforge.net/svnroot/dspace'
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2004 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-08 12:24:43 +00:00
Mark Diggory
2672caf7d8 Share project 'dspace-pom' into 'https://dspace.svn.sourceforge.net/svnroot/dspace'
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2003 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-08 12:24:18 +00:00
Mark Diggory
42ac93ec02 Adjust POM to support template filtering of properties files and separate dspace-pom project (currently resolved via maven repo) for dspace maven build defaults.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2002 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-08 04:09:17 +00:00
Mark Diggory
b20259e13d Comments on changes to language-packs
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2001 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-08 04:06:31 +00:00
Mark Diggory
145ce2d48f Returning to usage of dspace/pom.xml as parent for DSpace Maven Projects / Addons.
Filter dspace.dir in web.xml on construction of the war.

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2000 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-07 20:33:57 +00:00
Mark Diggory
4dd0fcdeb4 Filter dspace.dir in web.xml on construction of the war.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1999 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-07 20:33:03 +00:00
Mark Diggory
de536de99d Returning to usage of dspace/pom.xml as parent for DSpace Maven Projects / Addons.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1998 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-07 20:32:10 +00:00
Mark Diggory
08b8d4e4ef Returning to usage of dspace/pom.xml as parent for DSpace Maven Projects / Addons
Language Packs can be compiled into your dspace distro via the addition of '-P lang' to the active profiles, they are inactive by default. This profile resides in the dspace-api pom.

git-svn-id: http://scm.dspace.org/svn/repo/trunk@1997 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-07 20:31:27 +00:00
Mark Diggory
c7709e7451 Returning to usage of dspace/pom.xml as parent for DSpace Maven Projects / Addons
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1996 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-07 20:30:09 +00:00
Mark Diggory
698d543bce Language Packs are now a DSpace Addon. They can be compiled into your dspace distro via the addition of '-P lang' to the active profiles, they are inactive by default. IF a UTF-8 properties file exists, then the non-UTF-* file has been removed, the Maven build process supports native2ascii conversion on packaging of the Jar.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1995 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-07 20:17:46 +00:00
James Rutherford
c961fb0f6a Fixed SF bug #1727034 Method MetadataField.unique() is incorrect for null values
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1994 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-07 11:43:11 +00:00
Claudia Juergen
3d16b52fe7 Updated to Messages.properties revision 1990
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1993 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-05 13:33:32 +00:00
Claudia Juergen
60a0dac75e (Elin Stangeland)
Updated Norwegian Messages files for DSpace 1.4.2

git-svn-id: http://scm.dspace.org/svn/repo/trunk@1992 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-05 13:09:26 +00:00
Mark Diggory
70d5880e71 Lets loose a directory level here.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1991 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-01 20:49:00 +00:00
Mark Diggory
da04d66c4f Moving Messages.properties into dspace-api/src/main/resources where it will automatically be compiled into dspace-api.jar for deployment into WARs and CLI application.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1990 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-01 16:40:29 +00:00
Mark Diggory
e04d5ac4c2 Add resource to support moving Messages.properties.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1989 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-06-01 16:31:32 +00:00
Mark Diggory
830260647c failonerror="no"
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1988 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-31 16:06:45 +00:00
Mark Diggory
f69689a454 Reintroduce functionality available via "install_code" target
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1987 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-31 15:57:56 +00:00
James Rutherford
2f07826c94 Fixed a minor typo.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1986 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-31 10:33:27 +00:00
Mark Diggory
1735ec79a4 Adjusted paths to produce new source distribution properly.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1985 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-30 20:48:08 +00:00
Mark Diggory
1e39acb5b2 "make-release-package" will be to produce a source distribution of specific Addons in the trunk. We will move it up to trunk and change paths to produce the releases.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1984 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-30 20:32:43 +00:00
Mark Diggory
fbcb26ced5 Change to be "bin" instead of postgres-assembly (which its not).
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1983 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-30 20:28:54 +00:00
Mark Diggory
69d0431d78 Use Maven Repositories to resolve Dependencies. If we ever want to have an Ant analog to Maven in the future, it is more than likely that it will use similar dependency resolution.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1982 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-30 19:57:00 +00:00
Mark Diggory
1124e684bb Use Maven Repositories to resolve Dependencies. If we ever want to have an Ant analog to Maven in the future, it is more than likely that it will use similar dependency resolution.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1981 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-30 19:56:37 +00:00
Mark Diggory
1edfd2b0fa Use Maven Repositories to resolve Dependencies. If we ever want to have an Ant analog to Maven in the future, it is more than likely that it will use similar dependency resolution.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1980 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-30 19:55:43 +00:00
Mark Diggory
53d932e003 Add in assembly to package phase so that "assembly:assembly" can be left off the command-line
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1979 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-30 19:37:39 +00:00
Mark Diggory
a8b10a9ce0 Shorten jar and war names to be more conventional.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1978 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-30 19:31:13 +00:00
Mark Diggory
13b2188e47 Changes to date.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1977 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-30 18:22:39 +00:00
Mark Diggory
bb92d22f08 Removing build stages from build.xml until further notice
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1976 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-30 18:18:53 +00:00
James Rutherford
aef4abaf94 fixed line endings
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1975 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-30 09:20:24 +00:00
Mark Diggory
adbc332aad Include release assembly that builds archives (tar.gz, tar.bz2, zip), correct issue with selecting postgres or oracle profile to build.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1974 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-29 17:45:11 +00:00
Mark Diggory
87d828a6f6 Include release assembly that builds archives (tar.gz, tar.bz2, zip), correct issue with selecting postgres or oracle profile to build.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1973 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-29 17:43:30 +00:00
Mark Diggory
46dbdccf99 dspace-maven plugin shouldn't have been included in build process yet.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1972 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-29 17:11:11 +00:00
Mark Diggory
ee973b5a5f Remove parent inheritance
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1971 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-29 15:02:07 +00:00
Mark Diggory
da8b996f80 Remove parent inheritance
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1970 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-29 15:01:22 +00:00
Mark Diggory
776e9c74f6 Remove parent inheritance
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1969 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-29 15:00:30 +00:00
Mark Diggory
e6e52487d1 Improved assembly that is not "profile" dependent.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1968 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-29 14:57:09 +00:00
Mark Diggory
3b8894c14d Add Maven Project descriptors and svn-ignores
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1963 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-23 18:51:02 +00:00
Mark Diggory
22e15ada14 Refactor AccountManager to remove dependency on webapp.util.UIUtil.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1962 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-23 18:36:35 +00:00
Mark Diggory
9e96b0dfdb Move DSpace Kernel Dependencies to dspace-api AddOn
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1961 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-23 16:42:11 +00:00
Mark Diggory
b82e5a019b Move Webapp dependencies out to Webapp Addons
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1960 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-23 16:24:54 +00:00
Mark Diggory
346a90f58f Move web.xml configurations to webapps.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1959 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-23 16:24:24 +00:00
Mark Diggory
808c79776c Move JSPUI Webapp resources to webapp.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1958 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-23 16:23:52 +00:00
Mark Diggory
ba4e7f6b9e Move DSpace kernel codebase to dspace-api
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1957 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-23 16:23:06 +00:00
Mark Diggory
faa66ba48c Move Webapp sources out to addons
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1956 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-23 16:22:17 +00:00
Mark Diggory
54ef740be8 New modular AddOn directory structure.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1955 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-23 16:21:15 +00:00
Mark Diggory
b2eedf6ebf First Stage of Reorganization: Refactoring of UIUtil to support separation of webui from kernel. See:
http://wiki.dspace.org/index.php/SimpleAddonMechanism/CodeReorganization#Preparation

git-svn-id: http://scm.dspace.org/svn/repo/trunk@1954 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-23 15:57:40 +00:00
Claudia Juergen
b1a8866440 - Corrected month name display for Chinese and Japanese month
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1951 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-22 08:45:29 +00:00
Claudia Juergen
3efb8a396d (Claudia Juergen)
SF Patch #1722557 for SF Bug #1549290 Suggest Features uses hard coded strings

git-svn-id: http://scm.dspace.org/svn/repo/trunk@1950 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-21 11:18:52 +00:00
Claudia Juergen
027b66733d (Claudia Juergen)
SF Patch #1722557 for SF Bug #1549290 Suggest Features uses hard coded strings

git-svn-id: http://scm.dspace.org/svn/repo/trunk@1949 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-21 11:16:57 +00:00
Claudia Juergen
24422f5a05 SF Patch 1450491 i18n configurable multilingualism support
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1947 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-18 13:50:29 +00:00
Mark Diggory
3235a26b57 Organize imports to eliminate unused dependencies.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1946 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-17 03:35:52 +00:00
James Rutherford
6dbaf9293c Fixed a couple of minor bugs in TableRowIterator.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1941 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-15 09:23:25 +00:00
Mark Diggory
fc1367e9ec Merging the following 1.4.x branch changes back to trunk.
r2514@libaxis1 (orig r1874):  cjuergen | 2007-04-25 07:58:05 -0400
 Error in jsp.tools.confirm-delete-community.confirm
 Referred to collection instead of community.
 r2561@libaxis1 (orig r1878):  mdiggory | 2007-04-30 23:23:52 -0400
 1.) Correct issues with InstallItem by double-checking handle if its null in Item.getHandle(); 
 2.) Change createIndex to index preemptively, same as updateIndex.
 r2562@libaxis1 (orig r1879):  stuartlewis | 2007-05-03 10:06:08 -0400
 SF Patch #1711982 Updates to short_description (null) field when editing/creat


git-svn-id: http://scm.dspace.org/svn/repo/trunk@1880 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-05-03 19:15:14 +00:00
Claudia Juergen
b1b099cee8 Error in jsp.tools.confirm-delete-community.confirm
Referred to collection instead of community.

git-svn-id: http://scm.dspace.org/svn/repo/trunk@1877 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-25 12:23:56 +00:00
Claudia Juergen
161053571d Error in jsp.tools.confirm-delete-community.confirm
Referred to collection instead of community.

git-svn-id: http://scm.dspace.org/svn/repo/trunk@1876 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-25 12:04:22 +00:00
Claudia Juergen
fc8ec5d367 Error in jsp.tools.confirm-delete-community.confirm
Referred to collection instead of community.

git-svn-id: http://scm.dspace.org/svn/repo/trunk@1875 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-25 12:00:44 +00:00
Claudia Juergen
9ff7741375 Error in jsp.tools.confirm-delete-community.confirm
Referred to collection instead of community.

git-svn-id: http://scm.dspace.org/svn/repo/trunk@1873 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-25 11:54:33 +00:00
James Rutherford
3071413e10 added some deprecation warnings
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1872 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-25 09:23:46 +00:00
Claudia Juergen
db8948ee19 Updated Bouncy Castle Package to jdk15 bouncy castle version 1.36
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1871 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-24 07:32:15 +00:00
Mark Diggory
ca7bd0428e Upgrading BouncyCastle jars to jdk-1.5 versions.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1869 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-23 19:13:10 +00:00
Mark Diggory
8d36d4dbd5 Restoring the work of the following patches (note this includes the file restorations on the previous commit 1867):
- SF Patch #1659868 Improved database level debugging
- SF Patch #1659901 Import community and collection structure
- SF Patch #1659837 ItemIterator now deals with item ids also
- SF Patch #1659796 Create administrator wtih command line options
- SF Patch #1659841 Add option to clear context object cache

(Stuart Lewis)
- SF Patch #1641678 [dspace]/bin scripts for import and export
- SF Patch #1642336 Restrict domains of self-registered users
- SF Patch #1587225 Google and html sitemap generator

(Dorothea Salo)
- SF Patch #1557948 Link subjects and authors on item pages

git-svn-id: http://scm.dspace.org/svn/repo/trunk@1868 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-23 18:11:16 +00:00
Mark Diggory
89566dec3d Restore files deleted (on 1.4.x branch) in merge, this is also restoring history on these files.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1867 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-23 17:11:06 +00:00
Mark Diggory
f548bd0d58 Merging revisions upto 1.4.2-beta back to trunk. Below is a list of the revisions included in this merge.
r2271@libaxis1 (orig r1780):  jrutherford | 2007-04-10 09:41:17 -0400
 Branching for 1.4.x development.
 
 r2272@libaxis1 (orig r1781):  jrutherford | 2007-04-10 12:31:50 -0400
 Removed the following patches:
 =========
 (Andrea Bollini)
 - SF Patch #1687815 Search function for select eperson JSPUI
 
 (Richard Jones)
 - SF Patch #1659868 Improved database level debugging
 - SF Patch #1659901 Import community and collection structure
 - SF Patch #1659837 ItemIterator now deals with item ids also
 - SF Patch #1659796 Create administrator wtih command line options
 - SF Patch #1659841 Add option to clear context object cache
 
 (Stuart Lewis)
 - SF Patch #1641678 [dspace]/bin scripts for import and export
 - SF Patch #1642336 Restrict domains of self-registered users
 - SF Patch #1587225 Google and html sitemap generator
 
 (Monika Mevenkamp)
 - SF Patch #1654466 dsprop convenience script
 
 (Dorothea Salo)
 - SF Patch #1557948 Link subjects and authors on item pages
 
 r2276@libaxis1 (orig r1785):  cjuergen | 2007-04-11 08:09:26 -0400
 (James Rutherford)
 - SF Patch #1695702 Update SubmitServlet to use default.language instead of "en" for SF bug 1636792 default.language not applied to new submissions
 r2277@libaxis1 (orig r1786):  cjuergen | 2007-04-11 08:13:24 -0400
 updated year in copyright statement
 r2280@libaxis1 (orig r1789):  mdiggory | 2007-04-11 15:39:28 -0400
 (Mark Diggory/Graham Triggs)
 - SF Patch 1655583 Fixes issues with FilterMedia, the UI and Index locking, includes 
   a lucene upgrade to support better management of index locking.
 r2281@libaxis1 (orig r1790):  jrutherford | 2007-04-12 04:40:31 -0400
 Fixed a bug in DSIndexer where there was a Long/long mixup.
 
 r2284@libaxis1 (orig r1793):  jrutherford | 2007-04-12 06:36:23 -0400
 updated to reflect the removal of lucene-sandbox.jar and the update of
 lucene.jar
 
 r2285@libaxis1 (orig r1794):  mdiggory | 2007-04-12 12:57:15 -0400
 Missing file for  [ 1655583 ] Avoid index lock with filter-media
 r2286@libaxis1 (orig r1795):  mdiggory | 2007-04-12 16:44:29 -0400
 rolling back DSpaceServletContextListener to previous revision.
 r2287@libaxis1 (orig r1796):  jrutherford | 2007-04-14 08:02:09 -0400
 (James Rutherford)
 - SF Patch #1699903 for SF Bug #1695692 make-release-package still uses CVS commands
 
 
 r2288@libaxis1 (orig r1797):  mdiggory | 2007-04-14 23:04:59 -0400
  [ 1655583 ] Avoid index lock with filter-media: More internal solution for orphaned file handles in Microsoft Windows. Close any open IndexSearcher on finalization, works in Servlet Engine or CLI.  Removed IndexReader from DSIndexer, get it from DSQuery so it can be managed there likewise.
 r2289@libaxis1 (orig r1798):  mdiggory | 2007-04-14 23:15:34 -0400
  [ 1655583 ] Correct small logic error introduced in last commit.
 r2290@libaxis1 (orig r1799):  jrutherford | 2007-04-17 08:15:58 -0400
 (Flavio Botelho)
 - SF Patch #1601946 for SF Bug #1601875 - Makes javascript idependent to form position
 
 r2455@libaxis1 (orig r1856):  jrutherford | 2007-04-20 06:40:41 -0400
 (Claudia Juergen)
 - SF Patch #1702177 For SF bug #1638605 bin/cleanup fails on deleted primary bitstream
 
 
 r2456@libaxis1 (orig r1857):  stuartlewis | 2007-04-20 08:33:26 -0400
 SF Patch #1445573 Stats not working in Oracle
 r2457@libaxis1 (orig r1858):  stuartlewis | 2007-04-20 08:36:01 -0400
 SF Patch #1445573 Stats not working in Oracle
 r2458@libaxis1 (orig r1859):  cjuergen | 2007-04-20 09:02:19 -0400
 Bouncy Castle libs required by the current pdfbox.jar for text extraction of encrypted pdf's
 r2459@libaxis1 (orig r1860):  cjuergen | 2007-04-20 09:02:49 -0400
 Bouncy Castle libs required by the current pdfbox.jar for text extraction of encrypted pdf's
 r2460@libaxis1 (orig r1861):  cjuergen | 2007-04-20 09:03:14 -0400
 License for Bouncy Castle libs required by the current pdfbox.jar for text extraction of encrypted pdf's
 r2461@libaxis1 (orig r1862):  cjuergen | 2007-04-20 09:03:29 -0400
 License for Bouncy Castle libs required by the current pdfbox.jar for text extraction of encrypted pdf's


git-svn-id: http://scm.dspace.org/svn/repo/trunk@1866 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-23 14:20:41 +00:00
James Rutherford
d714758e92 Switched some method calls to use varargs properly (should eliminate all
compile-time warnings about varargs).


git-svn-id: http://scm.dspace.org/svn/repo/trunk@1865 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-23 10:28:41 +00:00
James Rutherford
81bd334582 Switched to using the varargs versions of various methods.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1864 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-23 10:20:16 +00:00
James Rutherford
de0fcf4781 Added a 'help' target to the build file. Now it is possible to run 'ant help'
to get a list of all available targets with short descriptions.


git-svn-id: http://scm.dspace.org/svn/repo/trunk@1855 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-19 13:22:25 +00:00
James Rutherford
603d4d0d76 Changed source and target to 1.5; trunk now requires JDK 1.5 or greater.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1800 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-18 13:37:10 +00:00
Claudia Juergen
230405a1bf Removed references to UPC
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1792 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-12 10:26:24 +00:00
Claudia Juergen
399251be86 updated year in copyright statement
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1784 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-11 11:27:52 +00:00
Claudia Juergen
6cae9d556a (Grupo de Usuarios de DSpace de España (GUDE))
Spanish language pack for DSpace 1.4.1

git-svn-id: http://scm.dspace.org/svn/repo/trunk@1783 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-11 09:07:52 +00:00
Claudia Juergen
86c16ad09f (Grupo de Usuarios de DSpace de España (GUDE))
Catalan language pack for DSpace 1.4.1

git-svn-id: http://scm.dspace.org/svn/repo/trunk@1782 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-11 09:07:14 +00:00
James Rutherford
99751294c9 (Stuart Lewis)
- SF Patch #1587225 Google and html sitemap generator


git-svn-id: http://scm.dspace.org/svn/repo/trunk@1779 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-09 12:06:58 +00:00
James Rutherford
00d924f0db (Stuart Lewis)
- SF Patch #1587225 Google and html sitemap generator

Note that this patch was modified to work with jdk 1.4. Once we are using jdk
1.5 or higher, the annotations can go back in.


git-svn-id: http://scm.dspace.org/svn/repo/trunk@1778 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-09 12:03:14 +00:00
James Rutherford
6e5a54f707 (Richard Jones)
- SF Patch #1659841 Add option to clear context object cache


git-svn-id: http://scm.dspace.org/svn/repo/trunk@1777 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-09 10:51:02 +00:00
James Rutherford
15db86801e (Richard Jones)
- SF Patch #1659796 Create administrator wtih command line options

Also updated create-adminstrator script and simplified dsprop script.


git-svn-id: http://scm.dspace.org/svn/repo/trunk@1776 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-09 10:47:06 +00:00
James Rutherford
2d02aa4e2b (Monika Mevenkamp)
- SF Patch #1654466 dsprop convenience script


git-svn-id: http://scm.dspace.org/svn/repo/trunk@1775 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-09 10:14:48 +00:00
Stuart Lewis
a64dbf8e37 Corrected typo in comment
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1768 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-06 20:16:10 +00:00
James Rutherford
1e64faade1 (Monika Mevenkamp)
- SF Patch #1654469 stat scripts always return exit code 1


git-svn-id: http://scm.dspace.org/svn/repo/trunk@1767 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-06 16:45:17 +00:00
James Rutherford
8091277eb7 (Stuart Lewis)
- SF Patch #1642336 Restrict domains of self-registered users


git-svn-id: http://scm.dspace.org/svn/repo/trunk@1766 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-06 14:51:06 +00:00
James Rutherford
236951fa78 (Stuart Lewis)
- SF Patch #1670110 for SF Bug #1670106 Onebox and textarea fail when visibility set to workflow
- SF Patch #1628889 Improve file size descriptions in ItemTag
- SF Patch #1641678 [dspace]/bin scripts for import and export


git-svn-id: http://scm.dspace.org/svn/repo/trunk@1765 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-06 14:15:48 +00:00
Andrea Bollini
e24d27cf74 SF Patch #1687815 Search function for select eperson JSPUI
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1764 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-06 09:09:52 +00:00
Andrea Bollini
e35be80261 (Andrea Bollini)
SF Patch #1689150 improvement of ControlledVocabulary

git-svn-id: http://scm.dspace.org/svn/repo/trunk@1763 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-06 09:03:14 +00:00
Robert Tansley
f0c5ceec69 (Robert Tansley)
- Fixes to QueryArgs and RegisterServlet that cause NullPointerExceptions on
  invalid input


git-svn-id: http://scm.dspace.org/svn/repo/trunk@1762 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-05 22:35:52 +00:00
Stuart Lewis
9b6c5729e4 SF Patch #1665400 Oracle schema changes for CLOB columns
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1761 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-05 15:35:38 +00:00
Robert Tansley
5d4033bae9 Adding svn:ignore for local/ directory
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1760 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-05 15:31:47 +00:00
Stuart Lewis
e027147bc2 SF Patch #1660752 Workaround Numeric/Integer handling in Oracle
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1759 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-05 15:26:37 +00:00
James Rutherford
2708a082d6 (James Rutherford)
- SF Patch #1694943 for SF feature request #1691277 Importing: Workaround for ext3 subdirectory limitation


git-svn-id: http://scm.dspace.org/svn/repo/trunk@1758 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-05 14:01:44 +00:00
Stuart Lewis
cd3468fba3 SF Patch #1688523 Bug fix - OAI harvest and Oracle
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1757 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-05 13:31:47 +00:00
James Rutherford
979b743325 (Richard Jones)
- SF Patch #1659837 ItemIterator now deals with item ids also


git-svn-id: http://scm.dspace.org/svn/repo/trunk@1756 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-05 11:09:16 +00:00
Claudia Juergen
a4c2a78300 (Claudia Juergen)
Fix for SF Bug #1690573 dspace-admin, edit item trailing white spaces

git-svn-id: http://scm.dspace.org/svn/repo/trunk@1755 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-04 11:40:55 +00:00
Robert Tansley
8a8b87ecd7 Setting svn:ignore to ignore postgresql JDBC driver jar
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1754 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-03 20:47:04 +00:00
Robert Tansley
7586d842ff Updated svn:ignore to ignore Eclipse project files and build/
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1753 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-03 20:26:21 +00:00
Robert Tansley
1373ad370c Updated svn:ignore to ignore Eclipse project files and build/
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1752 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-04-03 20:24:35 +00:00
Stuart Lewis
d5cb57a50a SF Patch #1659901 Import community and collection structure
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1751 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-03-30 12:37:40 +00:00
Stuart Lewis
b8f91d989a SF Patch #1659901 Import community and collection structure
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1750 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-03-30 11:12:17 +00:00
Claudia Juergen
80c7f6bc48 (Stuart Lewis)
- SF Patch #1628889 Improve file size descriptions in ItemTag

git-svn-id: http://scm.dspace.org/svn/repo/trunk@1749 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-03-30 09:19:12 +00:00
Stuart Lewis
e6e7c5a0ca SF Patch 1676370 Bug #1648070 Statistics does not use navbar="admin"
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1737 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-03-12 13:47:23 +00:00
Stuart Lewis
dd9e736e6e SF Patch #1659868 Improved database level debugging
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1736 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-03-12 13:20:41 +00:00
Stuart Lewis
0ebb61bd12 SF Patch #1659868 Improved database level debugging
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1735 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-03-12 13:20:16 +00:00
Mark Diggory
0c48621b3b Correcting typo in mods/mets crosswalk (causes errors in OAI). Have to point out storing xml as values of a java properties file not only unvalidatable but also not horrible to internationalize. This should seriously be considered for replacement/rearchitecture.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1734 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-03-10 03:20:54 +00:00
Claudia Juergen
fb8f13300e (Claudia Juergen)
Fix for SF Bug #1653151 Checker file shows filter-media (just a typo in header)
Fixed bin/index-all similar typo

git-svn-id: http://scm.dspace.org/svn/repo/trunk@1733 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-03-05 16:08:44 +00:00
Claudia Juergen
ec71506205 (StuartLewis)
SF Patch #1670110 for SF Bug #1670106 Onebox and textarea fail when visibility set to workflow

git-svn-id: http://scm.dspace.org/svn/repo/trunk@1732 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-03-05 15:59:46 +00:00
Claudia Juergen
1ede94f58c French Messages.properties compliant to DSpace 1.4.1
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1729 9c30dcfa-912a-0410-8fc2-9e0234be79fd
2007-03-05 14:32:37 +00:00
1215 changed files with 165444 additions and 55708 deletions

11
LICENSING_NOTICE.txt Normal file
View File

@@ -0,0 +1,11 @@
Licensing Notice
The DSpace Foundation, Inc. is a 501(c)3 corporation established in July 2007
with a mission to promote and advance the dspace platform enabling management,
access and preservation of digital works. The Foundation was able to transfer
the legal copyright from Hewlett-Packard Company (HP) and Massachusetts
Institute of Technology (MIT) to the DSpace Foundation in October 2007. Many
of the files in the source code may contain a copyright statement stating HP
and MIT posses the copyright, in these instances please note that the copy
right has transfered to the DSpace foundation.

24
README Normal file
View File

@@ -0,0 +1,24 @@
DSpace Version 1.5-SNAPSHOT, $Date: 2007-10-29 21:19:02 -0500 (Mon, 29 Oct 2007) $
Installation instructions are included in this release package under
dspace/docs/install.html
Documentation for the most recent stable release may be viewed online at
dspace.org:
http://dspace.org/technology/system-docs/
Installation instructions for other version may be different, so you
are encouraged to obtain the corresponding documentation package from
SourceForge, or to download the latest documentation snapshot from SVN
Please also read the dspace/KNOWN_BUGS file.
Please refer any further problems to the dspace-tech@lists.sourceforge.net
mailing list.
http://sourceforge.net/mail/?group_id=19984
Copyright (c) 2002-2006, Hewlett-Packard Company and Massachusetts
Institute of Technology. All rights reserved.

193
dspace-api/pom.xml Normal file
View File

@@ -0,0 +1,193 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.dspace</groupId>
<artifactId>dspace-api</artifactId>
<name>DSpace Kernel :: API and Implementation</name>
<description>DSpace core data model and service APIs.</description>
<url>http://projects.dspace.org/dspace-api</url>
<!--
A Parent POM that Maven inherits DSpace Defaults
POM atrributes from.
-->
<parent>
<groupId>org.dspace</groupId>
<artifactId>dspace-parent</artifactId>
<version>1.5.0</version>
</parent>
<repositories>
<repository>
<id>maven.dspace.org/snapshot</id>
<name>DSpace Maven Snapshot Repository</name>
<url>http://maven.dspace.org/snapshot</url>
<releases>
<enabled>false</enabled>
<checksumPolicy>fail</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>maven.dspace.org/snapshot</id>
<name>DSpace Maven Repository</name>
<url>http://maven.dspace.org/snapshot</url>
<releases>
<enabled>false</enabled>
<checksumPolicy>fail</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
<!--
The Subversion repository location is used by Continuum to update against
when changes have occured, this spawns a new build cycle and releases snapshots
into the snapshot repository below.
-->
<scm>
<connection>scm:svn:http://dspace.svn.sourceforge.net/svnroot/dspace/tags/dspace-1_5/dspace</connection>
<developerConnection>scm:svn:https://dspace.svn.sourceforge.net/svnroot/dspace/tags/dspace-1_5/dspace</developerConnection>
<url>http://dspace.svn.sourceforge.net/viewvc/dspace/tags/dspace-1_5/dspace</url>
</scm>
<!--
Runtime and Compile Time dependencies for DSpace.
-->
<dependencies>
<dependency>
<groupId>org.dspace</groupId>
<artifactId>handle</artifactId>
</dependency>
<dependency>
<groupId>org.dspace</groupId>
<artifactId>jargon</artifactId>
</dependency>
<dependency>
<groupId>org.dspace</groupId>
<artifactId>mets</artifactId>
</dependency>
<dependency>
<groupId>org.textmining</groupId>
<artifactId>tm-extractors</artifactId>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<exclusions>
<exclusion>
<artifactId>xom</artifactId>
<groupId>xom</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>oro</groupId>
<artifactId>oro</artifactId>
</dependency>
<dependency>
<groupId>pdfbox</groupId>
<artifactId>pdfbox</artifactId>
</dependency>
<dependency>
<groupId>org.fontbox</groupId>
<artifactId>fontbox</artifactId>
</dependency>
<dependency>
<groupId>org.jempbox</groupId>
<artifactId>jempbox</artifactId>
</dependency>
<dependency>
<groupId>poi</groupId>
<artifactId>poi</artifactId>
</dependency>
<dependency>
<groupId>rome</groupId>
<artifactId>rome</artifactId>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xmlParserAPIs</artifactId>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,266 @@
/*
* CreateAdministrator.java
*
* Version: $Revision$
*
* Date: $Date$
*
* Copyright (c) 2002-2005, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.administer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Locale;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.PosixParser;
import org.dspace.core.ConfigurationManager;
import org.dspace.core.Context;
import org.dspace.core.I18nUtil;
import org.dspace.eperson.EPerson;
import org.dspace.eperson.Group;
/**
* A command-line tool for creating an initial administrator for setting up a
* DSpace site. Prompts for an e-mail address, last name, first name and
* password from standard input. An administrator group is then created and the
* data passed in used to create an e-person in that group.
* <P>
* Alternatively, it can be used to take the email, first name, last name and
* desired password as arguments thus:
*
* CreateAdministrator -e [email] -f [first name] -l [last name] -p [password]
*
* This is particularly convenient for automated deploy scripts that require an
* initial administrator, for example, before deployment can be completed
*
* @author Robert Tansley
* @author Richard Jones
*
* @version $Revision$
*/
public class CreateAdministrator
{
/** DSpace Context object */
private Context context;
/**
* For invoking via the command line. If called with no command line arguments,
* it will negotiate with the user for the administrator details
*
* @param argv
* command-line arguments
*/
public static void main(String[] argv)
throws Exception
{
CommandLineParser parser = new PosixParser();
Options options = new Options();
CreateAdministrator ca = new CreateAdministrator();
options.addOption("e", "email", true, "administrator email address");
options.addOption("f", "first", true, "administrator first name");
options.addOption("l", "last", true, "administrator lastt name");
options.addOption("c", "language", true, "administrator language");
options.addOption("p", "password", true, "administrator password");
CommandLine line = parser.parse(options, argv);
if (line.hasOption("e") && line.hasOption("f") && line.hasOption("l") &&
line.hasOption("c") && line.hasOption("p"))
{
ca.createAdministrator(line.getOptionValue("e"),
line.getOptionValue("f"), line.getOptionValue("l"),
line.getOptionValue("c"), line.getOptionValue("p"));
}
else
{
ca.negotiateAdministratorDetails();
}
}
/**
* constructor, which just creates and object with a ready context
*
* @throws Exception
*/
private CreateAdministrator()
throws Exception
{
context = new Context();
}
/**
* Method which will negotiate with the user via the command line to
* obtain the administrator's details
*
* @throws Exception
*/
private void negotiateAdministratorDetails()
throws Exception
{
// For easier reading of typing
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Creating an initial administrator account");
boolean dataOK = false;
String email = null;
String firstName = null;
String lastName = null;
String password1 = null;
String password2 = null;
String language = I18nUtil.DEFAULTLOCALE.getLanguage();
while (!dataOK)
{
System.out.print("E-mail address: ");
System.out.flush();
email = input.readLine().trim();
System.out.print("First name: ");
System.out.flush();
firstName = input.readLine().trim();
System.out.print("Last name: ");
System.out.flush();
lastName = input.readLine().trim();
if (ConfigurationManager.getProperty("webui.supported.locales") != null)
{
System.out.println("Select one of the following languages: " + ConfigurationManager.getProperty("webui.supported.locales"));
System.out.print("Language: ");
System.out.flush();
language = input.readLine().trim();
language = I18nUtil.getSupportedLocale(new Locale(language)).getLanguage();
}
System.out.println("WARNING: Password will appear on-screen.");
System.out.print("Password: ");
System.out.flush();
password1 = input.readLine().trim();
System.out.print("Again to confirm: ");
System.out.flush();
password2 = input.readLine().trim();
if (!password1.equals("") && password1.equals(password2))
{
// password OK
System.out.print("Is the above data correct? (y or n): ");
System.out.flush();
String s = input.readLine().trim();
if (s.toLowerCase().startsWith("y"))
{
dataOK = true;
}
}
else
{
System.out.println("Passwords don't match");
}
}
// if we make it to here, we are ready to create an administrator
createAdministrator(email, firstName, lastName, language, password1);
}
/**
* Create the administrator with the given details. If the user
* already exists then they are simply upped to administrator status
*
* @param email the email for the user
* @param first user's first name
* @param last user's last name
* @param ps desired password
*
* @throws Exception
*/
private void createAdministrator(String email, String first, String last,
String language, String pw)
throws Exception
{
// Of course we aren't an administrator yet so we need to
// circumvent authorisation
context.setIgnoreAuthorization(true);
// Find administrator group
Group admins = Group.find(context, 1);
if (admins == null)
{
throw new Exception("Error, no admin group (group 1) found");
}
// Create the administrator e-person
EPerson eperson = EPerson.findByEmail(context,email);
// check if the email belongs to a registered user,
// if not create a new user with this email
if (eperson == null)
{
eperson = EPerson.create(context);
eperson.setEmail(email);
eperson.setCanLogIn(true);
eperson.setRequireCertificate(false);
eperson.setSelfRegistered(false);
}
eperson.setLastName(last);
eperson.setFirstName(first);
eperson.setLanguage(language);
eperson.setPassword(pw);
eperson.update();
admins.addMember(eperson);
admins.update();
context.complete();
System.out.println("Administrator account created");
}
}

View File

@@ -0,0 +1,318 @@
package org.dspace.administer;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
import org.apache.xml.serialize.Method;
import org.apache.xml.serialize.OutputFormat;
import org.apache.xml.serialize.XMLSerializer;
import org.dspace.content.MetadataField;
import org.dspace.content.MetadataSchema;
import org.dspace.core.Context;
import org.xml.sax.SAXException;
/**
* @author Graham Triggs
*
* This class creates an xml document as passed in the arguments and
* from the metadata schemas for the repository.
*
* The form of the XML is as follows
*
* <metadata-schemas>
* <schema>
* <name>dc</name>
* <namespace>http://dublincore.org/documents/dcmi-terms/</namespace>
* </schema>
* </metadata-schemas>
*/
public class MetadataExporter
{
/**
* @param args
* @throws ParseException
* @throws SAXException
* @throws IOException
* @throws SQLException
* @throws RegistryExportException
*/
public static void main(String[] args) throws ParseException, SQLException, IOException, SAXException, RegistryExportException
{
// create an options object and populate it
CommandLineParser parser = new PosixParser();
Options options = new Options();
options.addOption("f", "file", true, "output xml file for registry");
options.addOption("s", "schema", true, "the name of the schema to export");
CommandLine line = parser.parse(options, args);
String file = null;
String schema = null;
if (line.hasOption('f'))
{
file = line.getOptionValue('f');
}
else
{
usage();
System.exit(0);
}
if (line.hasOption('s'))
{
schema = line.getOptionValue('s');
}
saveRegistry(file, schema);
}
public static void saveRegistry(String file, String schema) throws SQLException, IOException, SAXException, RegistryExportException
{
// create a context
Context context = new Context();
context.setIgnoreAuthorization(true);
OutputFormat xmlFormat = new OutputFormat(Method.XML, "UTF-8", true);
xmlFormat.setLineWidth(120);
xmlFormat.setIndent(4);
XMLSerializer xmlSerializer = new XMLSerializer(new BufferedWriter(new FileWriter(file)), xmlFormat);
// XMLSerializer xmlSerializer = new XMLSerializer(System.out, xmlFormat);
xmlSerializer.startDocument();
xmlSerializer.startElement("dspace-dc-types", null);
// Save the schema defintion(s)
saveSchema(context, xmlSerializer, schema);
MetadataField[] mdFields = null;
// If a single schema has been specified
if (schema != null && !"".equals(schema))
{
// Get the id of that schema
MetadataSchema mdSchema = MetadataSchema.find(context, schema);
if (mdSchema == null)
{
throw new RegistryExportException("no schema to export");
}
// Get the metadata fields only for the specified schema
mdFields = MetadataField.findAllInSchema(context, mdSchema.getSchemaID());
}
else
{
// Get the metadata fields for all the schemas
mdFields = MetadataField.findAll(context);
}
// Output the metadata fields
for (MetadataField mdField : mdFields)
{
saveType(context, xmlSerializer, mdField);
}
xmlSerializer.endElement("dspace-dc-types");
xmlSerializer.endDocument();
// abort the context, as we shouldn't have changed it!!
context.abort();
}
/**
* Serialize the schema registry. If the parameter 'schema' is null or empty, save all schemas
* @param context
* @param xmlSerializer
* @param schema
* @throws SQLException
* @throws SAXException
* @throws RegistryExportException
*/
public static void saveSchema(Context context, XMLSerializer xmlSerializer, String schema) throws SQLException, SAXException, RegistryExportException
{
if (schema != null && !"".equals(schema))
{
// Find a single named schema
MetadataSchema mdSchema = MetadataSchema.find(context, schema);
saveSchema(xmlSerializer, mdSchema);
}
else
{
// Find all schemas
MetadataSchema[] mdSchemas = MetadataSchema.findAll(context);
for (MetadataSchema mdSchema : mdSchemas)
{
saveSchema(xmlSerializer, mdSchema);
}
}
}
/**
* Serialize a single schema (namespace) registry entry
*
* @param xmlSerializer
* @param mdSchema
* @throws SAXException
* @throws RegistryExportException
*/
private static void saveSchema(XMLSerializer xmlSerializer, MetadataSchema mdSchema) throws SAXException, RegistryExportException
{
// If we haven't got a schema, it's an error
if (mdSchema == null)
{
throw new RegistryExportException("no schema to export");
}
String name = mdSchema.getName();
String namespace = mdSchema.getNamespace();
if (name == null || "".equals(name))
{
System.out.println("name is null, skipping");
return;
}
if (namespace == null || "".equals(namespace))
{
System.out.println("namespace is null, skipping");
return;
}
// Output the parent tag
xmlSerializer.startElement("dc-schema", null);
// Output the schema name
xmlSerializer.startElement("name", null);
xmlSerializer.characters(name.toCharArray(), 0, name.length());
xmlSerializer.endElement("name");
// Output the schema namespace
xmlSerializer.startElement("namespace", null);
xmlSerializer.characters(namespace.toCharArray(), 0, namespace.length());
xmlSerializer.endElement("namespace");
xmlSerializer.endElement("dc-schema");
}
/**
* Serialize a single metadata field registry entry to xml
*
* @param context
* @param xmlSerializer
* @param mdField
* @throws SAXException
* @throws RegistryExportException
* @throws SQLException
* @throws IOException
*/
private static void saveType(Context context, XMLSerializer xmlSerializer, MetadataField mdField) throws SAXException, RegistryExportException, SQLException, IOException
{
// If we haven't been given a field, it's an error
if (mdField == null)
{
throw new RegistryExportException("no field to export");
}
// Get the data from the metadata field
String schemaName = getSchemaName(context, mdField);
String element = mdField.getElement();
String qualifier = mdField.getQualifier();
String scopeNote = mdField.getScopeNote();
// We must have a schema and element
if (schemaName == null || element == null)
{
throw new RegistryExportException("incomplete field information");
}
// Output the parent tag
xmlSerializer.startElement("dc-type", null);
// Output the schema name
xmlSerializer.startElement("schema", null);
xmlSerializer.characters(schemaName.toCharArray(), 0, schemaName.length());
xmlSerializer.endElement("schema");
// Output the element
xmlSerializer.startElement("element", null);
xmlSerializer.characters(element.toCharArray(), 0, element.length());
xmlSerializer.endElement("element");
// Output the qualifier, if present
if (qualifier != null)
{
xmlSerializer.startElement("qualifier", null);
xmlSerializer.characters(qualifier.toCharArray(), 0, qualifier.length());
xmlSerializer.endElement("qualifier");
}
else
{
xmlSerializer.comment("unqualified");
}
// Output the scope note, if present
if (scopeNote != null)
{
xmlSerializer.startElement("scope_note", null);
xmlSerializer.characters(scopeNote.toCharArray(), 0, scopeNote.length());
xmlSerializer.endElement("scope_note");
}
else
{
xmlSerializer.comment("no scope note");
}
xmlSerializer.endElement("dc-type");
}
/**
* Helper method to retrieve a schema name for the field.
* Caches the name after looking up the id.
*/
static Map<Integer, String> schemaMap = new HashMap<Integer, String>();
private static String getSchemaName(Context context, MetadataField mdField) throws SQLException, RegistryExportException
{
// Get name from cache
String name = schemaMap.get(new Integer(mdField.getSchemaID()));
if (name == null)
{
// Name not retrieved before, so get the schema now
MetadataSchema mdSchema = MetadataSchema.find(context, mdField.getSchemaID());
if (mdSchema != null)
{
name = mdSchema.getName();
schemaMap.put(new Integer(mdSchema.getSchemaID()), name);
}
else
{
// Can't find the schema
throw new RegistryExportException("Can't get schema name for field");
}
}
return name;
}
/**
* Print the usage message to stdout
*/
public static void usage()
{
String usage = "Use this class with the following options:\n" +
" -f <xml output file> : specify the output file for the schemas\n" +
" -s <schema> : name of the schema to export\n";
System.out.println(usage);
}
}

View File

@@ -0,0 +1,296 @@
/*
* MetadataImporter.java
*
* Copyright (c) 2006, Imperial College London. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Imperial College nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.administer;
import java.io.File;
import java.io.IOException;
import java.sql.SQLException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
import org.apache.xpath.XPathAPI;
import org.dspace.administer.DCType;
import org.dspace.authorize.AuthorizeException;
import org.dspace.content.MetadataField;
import org.dspace.content.MetadataSchema;
import org.dspace.content.NonUniqueMetadataException;
import org.dspace.core.Context;
import org.dspace.core.LogManager;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.NamedNodeMap;
import org.xml.sax.SAXException;
/**
* @author Richard Jones
*
* This class takes an xml document as passed in the arguments and
* uses it to create metadata elements in the Metadata Registry if
* they do not already exist
*
* The format of the XML file is as follows:
*
* <dspace-dc-types>
* <dc-type>
* <schema>icadmin</schema>
* <element>status</element>
* <qualifier>dateset</qualifier>
* <scope_note>the workflow status of an item</scope_note>
* </dc-type>
*
* [....]
*
* </dspace-dc-types>
*/
public class MetadataImporter
{
/**
* main method for reading user input from the command line
*/
public static void main(String[] args)
throws ParseException, SQLException, IOException, TransformerException,
ParserConfigurationException, AuthorizeException, SAXException,
NonUniqueMetadataException, RegistryImportException
{
boolean forceUpdate = false;
// create an options object and populate it
CommandLineParser parser = new PosixParser();
Options options = new Options();
options.addOption("f", "file", true, "source xml file for DC fields");
options.addOption("u", "update", false, "update an existing schema");
CommandLine line = parser.parse(options, args);
String file = null;
if (line.hasOption('f'))
{
file = line.getOptionValue('f');
}
else
{
usage();
System.exit(0);
}
forceUpdate = line.hasOption('u');
loadRegistry(file, forceUpdate);
}
/**
* Load the data from the specified file path into the database
*
* @param file the file path containing the source data
*/
public static void loadRegistry(String file, boolean forceUpdate)
throws SQLException, IOException, TransformerException, ParserConfigurationException,
AuthorizeException, SAXException, NonUniqueMetadataException, RegistryImportException
{
// create a context
Context context = new Context();
context.setIgnoreAuthorization(true);
// read the XML
Document document = RegistryImporter.loadXML(file);
// Get the nodes corresponding to types
NodeList schemaNodes = XPathAPI.selectNodeList(document, "/dspace-dc-types/dc-schema");
// Add each one as a new format to the registry
for (int i = 0; i < schemaNodes.getLength(); i++)
{
Node n = schemaNodes.item(i);
loadSchema(context, n, forceUpdate);
}
// Get the nodes corresponding to types
NodeList typeNodes = XPathAPI.selectNodeList(document, "/dspace-dc-types/dc-type");
// Add each one as a new format to the registry
for (int i = 0; i < typeNodes.getLength(); i++)
{
Node n = typeNodes.item(i);
loadType(context, n);
}
context.complete();
}
/**
* Process a node in the metadata registry XML file. If the
* schema already exists, it will not be recreated
*
* @param context
* DSpace context object
* @param node
* the node in the DOM tree
* @throws NonUniqueMetadataException
*/
private static void loadSchema(Context context, Node node, boolean updateExisting)
throws SQLException, IOException, TransformerException,
AuthorizeException, NonUniqueMetadataException, RegistryImportException
{
// Get the values
String name = RegistryImporter.getElementData(node, "name");
String namespace = RegistryImporter.getElementData(node, "namespace");
if (name == null || "".equals(name))
{
throw new RegistryImportException("Name of schema must be supplied");
}
if (namespace == null || "".equals(namespace))
{
throw new RegistryImportException("Namespace of schema must be supplied");
}
System.out.print("Registering Schema: " + name + " - " + namespace + " ... ");
// check to see if the schema already exists
MetadataSchema s = MetadataSchema.find(context, name);
if (s == null)
{
// Schema does not exist - create
MetadataSchema schema = new MetadataSchema(namespace, name);
schema.create(context);
System.out.println("created");
}
else
{
// Schema exists - if it's the same namespace, allow the type imports to continue
if (s.getNamespace().equals(namespace))
{
System.out.println("already exists, skipping to type import");
return;
}
// It's a different namespace - have we been told to update?
if (updateExisting)
{
// Update the existing schema namespace and continue to type import
s.setNamespace(namespace);
s.update(context);
System.out.println("namespace updated (" + name + " = " + namespace + ")");
}
else
{
// Don't update the existing namespace - abort abort abort
System.out.println("schema exists, but with different namespace");
System.out.println("was: " + s.getNamespace());
System.out.println("xml: " + namespace);
System.out.println("aborting - use -u to force the update");
throw new RegistryImportException("schema already registerd with different namespace - use -u to update");
}
}
}
/**
* Process a node in the metadata registry XML file. The node must
* be a "dc-type" node. If the type already exists, then it
* will not be reimported
*
* @param context
* DSpace context object
* @param node
* the node in the DOM tree
* @throws NonUniqueMetadataException
*/
private static void loadType(Context context, Node node)
throws SQLException, IOException, TransformerException,
AuthorizeException, NonUniqueMetadataException, RegistryImportException
{
// Get the values
String schema = RegistryImporter.getElementData(node, "schema");
String element = RegistryImporter.getElementData(node, "element");
String qualifier = RegistryImporter.getElementData(node, "qualifier");
String scopeNote = RegistryImporter.getElementData(node, "scope_note");
// If the schema is not provided default to DC
if (schema == null)
{
schema = MetadataSchema.DC_SCHEMA;
}
System.out.print("Registering Metadata: " + schema + "." + element + "." + qualifier + " ... ");
// Find the matching schema object
MetadataSchema schemaObj = MetadataSchema.find(context, schema);
if (schemaObj == null)
{
throw new RegistryImportException("Schema '" + schema + "' is not registered");
}
MetadataField mf = MetadataField.findByElement(context, schemaObj.getSchemaID(), element, qualifier);
if (mf != null)
{
System.out.println("already exists, skipping");
return;
}
MetadataField field = new MetadataField();
field.setSchemaID(schemaObj.getSchemaID());
field.setElement(element);
field.setQualifier(qualifier);
field.setScopeNote(scopeNote);
field.create(context);
System.out.println("created");
}
/**
* Print the usage message to stdout
*/
public static void usage()
{
String usage = "Use this class with the following option:\n" +
" -f <xml source file> : specify which xml source file " +
"contains the DC fields to import.\n";
System.out.println(usage);
}
}

View File

@@ -0,0 +1,84 @@
/*
* RegistryImportException.java
*
* Copyright (c) 2006, Imperial College London. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Imperial College nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.administer;
/**
* @author Graham Triggs
*
* An exception to report any problems with registry exports
*/
public class RegistryExportException extends Exception
{
private Exception e;
/**
* Create an empty authorize exception
*/
public RegistryExportException()
{
super();
}
/**
* create an exception with only a message
*
* @param message
*/
public RegistryExportException(String message)
{
super(message);
}
/**
* create an exception with an inner exception and a message
*
* @param message
* @param e
*/
public RegistryExportException(String message, Throwable e)
{
super(message, e);
}
/**
* create an exception with an inner exception
*
* @param e
*/
public RegistryExportException(Throwable e)
{
super(e);
}
}

View File

@@ -0,0 +1,84 @@
/*
* RegistryImportException.java
*
* Copyright (c) 2006, Imperial College London. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Imperial College nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.administer;
/**
* @author Richard Jones
*
* An exception to report any problems with registry imports
*/
public class RegistryImportException extends Exception
{
private Exception e;
/**
* Create an empty authorize exception
*/
public RegistryImportException()
{
super();
}
/**
* create an exception with only a message
*
* @param message
*/
public RegistryImportException(String message)
{
super(message);
}
/**
* create an exception with an inner exception and a message
*
* @param message
* @param e
*/
public RegistryImportException(String message, Throwable e)
{
super(message, e);
}
/**
* create an exception with an inner exception
*
* @param e
*/
public RegistryImportException(Throwable e)
{
super(e);
}
}

View File

@@ -0,0 +1,183 @@
/*
* RegistryImporter.java
*
* Copyright (c) 2006, Imperial College London. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Imperial College nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.administer;
import java.io.File;
import java.io.IOException;
import java.sql.SQLException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
import org.apache.xpath.XPathAPI;
import org.dspace.administer.DCType;
import org.dspace.authorize.AuthorizeException;
import org.dspace.content.MetadataField;
import org.dspace.content.MetadataSchema;
import org.dspace.content.NonUniqueMetadataException;
import org.dspace.core.Context;
import org.dspace.core.LogManager;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.NamedNodeMap;
import org.xml.sax.SAXException;
/**
* @author Richard Jones
*
* This class provides the tools that registry importers might need to
* use. Basically some utility methods. And actually, although it says
* I am the author, really I ripped these methods off from other
* classes
*/
public class RegistryImporter
{
/**
* Load in the XML from file.
*
* @param filename
* the filename to load from
*
* @return the DOM representation of the XML file
*/
public static Document loadXML(String filename)
throws IOException, ParserConfigurationException, SAXException
{
DocumentBuilder builder = DocumentBuilderFactory.newInstance()
.newDocumentBuilder();
Document document = builder.parse(new File(filename));
return document;
}
/**
* Get the CDATA of a particular element. For example, if the XML document
* contains:
* <P>
* <code>
* &lt;foo&gt;&lt;mimetype&gt;application/pdf&lt;/mimetype&gt;&lt;/foo&gt;
* </code>
* passing this the <code>foo</code> node and <code>mimetype</code> will
* return <code>application/pdf</code>.
* </P>
* Why this isn't a core part of the XML API I do not know...
*
* @param parentElement
* the element, whose child element you want the CDATA from
* @param childName
* the name of the element you want the CDATA from
*
* @return the CDATA as a <code>String</code>
*/
public static String getElementData(Node parentElement, String childName)
throws TransformerException
{
// Grab the child node
Node childNode = XPathAPI.selectSingleNode(parentElement, childName);
if (childNode == null)
{
// No child node, so no values
return null;
}
// Get the #text
Node dataNode = childNode.getFirstChild();
if (dataNode == null)
{
return null;
}
// Get the data
String value = dataNode.getNodeValue().trim();
return value;
}
/**
* Get repeated CDATA for a particular element. For example, if the XML
* document contains:
* <P>
* <code>
* &lt;foo&gt;
* &lt;bar&gt;val1&lt;/bar&gt;
* &lt;bar&gt;val2&lt;/bar&gt;
* &lt;/foo&gt;
* </code>
* passing this the <code>foo</code> node and <code>bar</code> will
* return <code>val1</code> and <code>val2</code>.
* </P>
* Why this also isn't a core part of the XML API I do not know...
*
* @param parentElement
* the element, whose child element you want the CDATA from
* @param childName
* the name of the element you want the CDATA from
*
* @return the CDATA as a <code>String</code>
*/
public static String[] getRepeatedElementData(Node parentElement,
String childName) throws TransformerException
{
// Grab the child node
NodeList childNodes = XPathAPI.selectNodeList(parentElement, childName);
String[] data = new String[childNodes.getLength()];
for (int i = 0; i < childNodes.getLength(); i++)
{
// Get the #text node
Node dataNode = childNodes.item(i).getFirstChild();
// Get the data
data[i] = dataNode.getNodeValue().trim();
}
return data;
}
}

View File

@@ -0,0 +1,616 @@
/*
* StructBuilder.java
*
* Copyright (c) 2006, Imperial College. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Imperial College nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.administer;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.sql.SQLException;
import java.util.Enumeration;
import java.util.Hashtable;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.PosixParser;
import org.apache.xpath.XPathAPI;
import org.dspace.authorize.AuthorizeException;
import org.dspace.content.Collection;
import org.dspace.content.Community;
import org.dspace.core.Context;
import org.dspace.eperson.EPerson;
import org.jdom.Element;
import org.jdom.output.XMLOutputter;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
/**
* This class deals with importing community and collection structures from
* an XML file.
*
* The XML file structure needs to be:
*
* <import_structure>
* <community>
* <name>....</name>
* <community>...</community>
* <collection>
* <name>....</name>
* </collection>
* </community>
* </import_structure>
*
* it can be arbitrarily deep, and supports all the metadata elements
* that make up the community and collection metadata. See the system
* documentation for more details
*
* @author Richard Jones
*
*/
public class StructBuilder
{
/** the output xml document which will contain updated information about the
* imported structure
*/
private static org.jdom.Document xmlOutput = new org.jdom.Document(new Element("imported_structure"));
/** a hashtable to hold metadata for the collection being worked on */
private static Hashtable collectionMap = new Hashtable();
/** a hashtable to hold metadata for the community being worked on */
private static Hashtable communityMap = new Hashtable();
/**
* Main method to be run from the command line to import a structure into
* DSpace
*
* This is of the form:
*
* StructBuilder -f [xml source] -e [administrator email] -o [output file]
*
* The output file will contain exactly the same as the source xml document, but
* with the handle for each imported item added as an attribute.
*/
public static void main(String[] argv)
throws Exception
{
CommandLineParser parser = new PosixParser();
Options options = new Options();
options.addOption( "f", "file", true, "file");
options.addOption( "e", "eperson", true, "eperson");
options.addOption("o", "output", true, "output");
CommandLine line = parser.parse( options, argv );
String file = null;
String eperson = null;
String output = null;
if (line.hasOption('f'))
{
file = line.getOptionValue('f');
}
if (line.hasOption('e'))
{
eperson = line.getOptionValue('e');
}
if (line.hasOption('o'))
{
output = line.getOptionValue('o');
}
if (output == null || eperson == null || file == null)
{
usage();
System.exit(0);
}
// create a context
Context context = new Context();
// set the context
context.setCurrentUser(EPerson.findByEmail(context, eperson));
// load the XML
Document document = loadXML(file);
// run the preliminary validation, to be sure that the the XML document
// is properly structured
validate(document);
// load the mappings into the member variable hashmaps
communityMap.put("name", "name");
communityMap.put("description", "short_description");
communityMap.put("intro", "introductory_text");
communityMap.put("copyright", "copyright_text");
communityMap.put("sidebar", "side_bar_text");
collectionMap.put("name", "name");
collectionMap.put("description", "short_description");
collectionMap.put("intro", "introductory_text");
collectionMap.put("copyright", "copyright_text");
collectionMap.put("sidebar", "side_bar_text");
collectionMap.put("license", "license");
collectionMap.put("provenance", "provenance_description");
// get the top level community list
NodeList first = XPathAPI.selectNodeList(document, "/import_structure/community");
// run the import starting with the top level communities
Element[] elements = handleCommunities(context, first, null);
// generate the output
Element root = xmlOutput.getRootElement();
for (int i = 0; i < elements.length; i++)
{
root.addContent(elements[i]);
}
// finally write the string into the output file
try
{
BufferedWriter out = new BufferedWriter(new FileWriter(output));
out.write(new XMLOutputter().outputString(xmlOutput));
out.close();
}
catch (IOException e)
{
System.out.println("Unable to write to output file " + output);
System.exit(0);
}
context.complete();
}
/**
* Output the usage information
*/
private static void usage()
{
System.out.println("Usage: java StructBuilder -f <source XML file> -o <output file> -e <eperson email>");
System.out.println("Communitities will be created from the top level, and a map of communities to handles will be returned in the output file");
return;
}
/**
* Validate the XML document. This method does not return, but if validation
* fails it generates an error and ceases execution
*
* @param document the XML document object
* @throws TransformerException
*
*/
private static void validate(org.w3c.dom.Document document)
throws TransformerException
{
StringBuffer err = new StringBuffer();
boolean trip = false;
err.append("The following errors were encountered parsing the source XML\n");
err.append("No changes have been made to the DSpace instance\n\n");
NodeList first = XPathAPI.selectNodeList(document, "/import_structure/community");
if (first.getLength() == 0)
{
err.append("-There are no top level communities in the source document");
System.out.println(err.toString());
System.exit(0);
}
String errs = validateCommunities(first, 1);
if (errs != null)
{
err.append(errs);
trip = true;
}
if (trip)
{
System.out.println(err.toString());
System.exit(0);
}
}
/**
* Validate the communities section of the XML document. This returns a string
* containing any errors encountered, or null if there were no errors
*
* @param communities the NodeList of communities to validate
* @param level the level in the XML document that we are at, for the purposes
* of error reporting
*
* @return the errors that need to be generated by the calling method, or null if
* no errors.
*/
private static String validateCommunities(NodeList communities, int level)
throws TransformerException
{
StringBuffer err = new StringBuffer();
boolean trip = false;
String errs = null;
for (int i = 0; i < communities.getLength(); i++)
{
Node n = communities.item(i);
NodeList name = XPathAPI.selectNodeList(n, "name");
if (name.getLength() != 1)
{
String pos = Integer.toString(i + 1);
err.append("-The level " + level + " community in position " + pos);
err.append(" does not contain exactly one name field\n");
trip = true;
}
// validate sub communities
NodeList subCommunities = XPathAPI.selectNodeList(n, "community");
String comErrs = validateCommunities(subCommunities, level + 1);
if (comErrs != null)
{
err.append(comErrs);
trip = true;
}
// validate collections
NodeList collections = XPathAPI.selectNodeList(n, "collection");
String colErrs = validateCollections(collections, level + 1);
if (colErrs != null)
{
err.append(colErrs);
trip = true;
}
}
if (trip)
{
errs = err.toString();
}
return errs;
}
/**
* validate the collection section of the XML document. This generates a
* string containing any errors encountered, or returns null if no errors
*
* @param collections a NodeList of collections to validate
* @param level the level in the XML document for the purposes of error reporting
*
* @return the errors to be generated by the calling method, or null if none
*/
private static String validateCollections(NodeList collections, int level)
throws TransformerException
{
StringBuffer err = new StringBuffer();
boolean trip = false;
String errs = null;
for (int i = 0; i < collections.getLength(); i++)
{
Node n = collections.item(i);
NodeList name = XPathAPI.selectNodeList(n, "name");
if (name.getLength() != 1)
{
String pos = Integer.toString(i + 1);
err.append("-The level " + level + " collection in position " + pos);
err.append(" does not contain exactly one name field\n");
trip = true;
}
}
if (trip)
{
errs = err.toString();
}
return errs;
}
/**
* Load in the XML from file.
*
* @param filename
* the filename to load from
*
* @return the DOM representation of the XML file
*/
private static org.w3c.dom.Document loadXML(String filename)
throws IOException, ParserConfigurationException, SAXException
{
DocumentBuilder builder = DocumentBuilderFactory.newInstance()
.newDocumentBuilder();
org.w3c.dom.Document document = builder.parse(new File(filename));
return document;
}
/**
* Return the String value of a Node
*
* @param node the node from which we want to extract the string value
*
* @return the string value of the node
*/
public static String getStringValue(Node node)
{
String value = node.getNodeValue();
if (node.hasChildNodes())
{
Node first = node.getFirstChild();
if (first.getNodeType() == Node.TEXT_NODE)
{
return first.getNodeValue().trim();
}
}
return value;
}
/**
* Take a node list of communities and build the structure from them, delegating
* to the relevant methods in this class for sub-communities and collections
*
* @param context the context of the request
* @param communities a nodelist of communities to create along with their subjstructures
* @param parent the parent community of the nodelist of communities to create
*
* @return an element array containing additional information regarding the
* created communities (e.g. the handles they have been assigned)
*/
private static Element[] handleCommunities(Context context, NodeList communities, Community parent)
throws TransformerException, SQLException, Exception
{
Element[] elements = new Element[communities.getLength()];
for (int i = 0; i < communities.getLength(); i++)
{
Community community;
Element element = new Element("community");
// create the community or sub community
if (parent != null)
{
community = parent.createSubcommunity();
}
else
{
community = Community.create(null, context);
}
// default the short description to be an empty string
community.setMetadata("short_description", " ");
// now update the metadata
Node tn = communities.item(i);
Enumeration keys = communityMap.keys();
while (keys.hasMoreElements())
{
Node node = null;
String key = (String) keys.nextElement();
NodeList nl = XPathAPI.selectNodeList(tn, key);
if (nl.getLength() == 1)
{
node = nl.item(0);
community.setMetadata((String) communityMap.get(key), getStringValue(node));
}
}
// FIXME: at the moment, if the community already exists by name
// then this will throw a PSQLException on a duplicate key
// violation
// Ideally we'd skip this row and continue to create sub
// communities
// and so forth where they don't exist, but it's proving
// difficult
// to isolate the community that already exists without hitting
// the database directly.
community.update();
// build the element with the handle that identifies the new
// community
// along with all the information that we imported here
// This looks like a lot of repetition of getting information
// from above
// but it's here to keep it separate from the create process in
// case
// we want to move it or make it switchable later
element.setAttribute("identifier", community.getHandle());
Element nameElement = new Element("name");
nameElement.setText(community.getMetadata("name"));
element.addContent(nameElement);
if (community.getMetadata("short_description") != null)
{
Element descriptionElement = new Element("description");
descriptionElement.setText(community.getMetadata("short_description"));
element.addContent(descriptionElement);
}
if (community.getMetadata("introductory_text") != null)
{
Element introElement = new Element("intro");
introElement.setText(community.getMetadata("introductory_text"));
element.addContent(introElement);
}
if (community.getMetadata("copyright_text") != null)
{
Element copyrightElement = new Element("copyright");
copyrightElement.setText(community.getMetadata("copyright_text"));
element.addContent(copyrightElement);
}
if (community.getMetadata("side_bar_text") != null)
{
Element sidebarElement = new Element("sidebar");
sidebarElement.setText(community.getMetadata("side_bar_text"));
element.addContent(sidebarElement);
}
// handle sub communities
NodeList subCommunities = XPathAPI.selectNodeList(tn, "community");
Element[] subCommunityElements = handleCommunities(context, subCommunities, community);
// handle collections
NodeList collections = XPathAPI.selectNodeList(tn, "collection");
Element[] collectionElements = handleCollections(context, collections, community);
int j;
for (j = 0; j < subCommunityElements.length; j++)
{
element.addContent(subCommunityElements[j]);
}
for (j = 0; j < collectionElements.length; j++)
{
element.addContent(collectionElements[j]);
}
elements[i] = element;
}
return elements;
}
/**
* Take a node list of collections and create the structure from them
*
* @param context the context of the request
* @param collections the node list of collections to be created
* @param parent the parent community to whom the collections belong
*
* @return an Element array containing additional information about the
* created collections (e.g. the handle)
*/
private static Element[] handleCollections(Context context, NodeList collections, Community parent)
throws TransformerException, SQLException, AuthorizeException, IOException, Exception
{
Element[] elements = new Element[collections.getLength()];
for (int i = 0; i < collections.getLength(); i++)
{
Element element = new Element("collection");
Collection collection = parent.createCollection();
// default the short description to the empty string
collection.setMetadata("short_description", " ");
// import the rest of the metadata
Node tn = collections.item(i);
Enumeration keys = collectionMap.keys();
while (keys.hasMoreElements())
{
Node node = null;
String key = (String) keys.nextElement();
NodeList nl = XPathAPI.selectNodeList(tn, key);
if (nl.getLength() == 1)
{
node = nl.item(0);
collection.setMetadata((String) collectionMap.get(key), getStringValue(node));
}
}
collection.update();
element.setAttribute("identifier", collection.getHandle());
Element nameElement = new Element("name");
nameElement.setText(collection.getMetadata("name"));
element.addContent(nameElement);
if (collection.getMetadata("short_description") != null)
{
Element descriptionElement = new Element("description");
descriptionElement.setText(collection.getMetadata("short_description"));
element.addContent(descriptionElement);
}
if (collection.getMetadata("introductory_text") != null)
{
Element introElement = new Element("intro");
introElement.setText(collection.getMetadata("introductory_text"));
element.addContent(introElement);
}
if (collection.getMetadata("copyright_text") != null)
{
Element copyrightElement = new Element("copyright");
copyrightElement.setText(collection.getMetadata("copyright_text"));
element.addContent(copyrightElement);
}
if (collection.getMetadata("side_bar_text") != null)
{
Element sidebarElement = new Element("sidebar");
sidebarElement.setText(collection.getMetadata("side_bar_text"));
element.addContent(sidebarElement);
}
if (collection.getMetadata("license") != null)
{
Element sidebarElement = new Element("license");
sidebarElement.setText(collection.getMetadata("license"));
element.addContent(sidebarElement);
}
if (collection.getMetadata("provenance_description") != null)
{
Element sidebarElement = new Element("provenance");
sidebarElement.setText(collection.getMetadata("provenance_description"));
element.addContent(sidebarElement);
}
elements[i] = element;
}
return elements;
}
}

View File

@@ -258,6 +258,7 @@ public class ChecksumChecker
checker.setDispatcher(dispatcher); checker.setDispatcher(dispatcher);
checker.setCollector(logger); checker.setCollector(logger);
checker.process(); checker.process();
System.exit(0);
} }
/** /**

View File

@@ -44,6 +44,7 @@ import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.InputStream; import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
@@ -85,6 +86,8 @@ import org.dspace.handle.HandleManager;
*/ */
public class ItemExport public class ItemExport
{ {
private static final int SUBDIR_LIMIT = 0;
/* /*
* *
*/ */
@@ -260,13 +263,39 @@ public class ItemExport
String destDirName, int seqStart) throws Exception String destDirName, int seqStart) throws Exception
{ {
int mySequenceNumber = seqStart; int mySequenceNumber = seqStart;
int counter = SUBDIR_LIMIT - 1;
int subDirSuffix = 0;
String fullPath = destDirName;
String subdir = "";
File dir;
if (SUBDIR_LIMIT > 0)
{
dir = new File(destDirName);
if (!dir.isDirectory())
{
throw new IOException(destDirName + " is not a directory.");
}
}
System.out.println("Beginning export"); System.out.println("Beginning export");
while (i.hasNext()) while (i.hasNext())
{ {
if (SUBDIR_LIMIT > 0 && ++counter == SUBDIR_LIMIT)
{
subdir = new Integer(subDirSuffix++).toString();
fullPath = destDirName + dir.separatorChar + subdir;
counter = 0;
if (!new File(fullPath).mkdirs())
{
throw new IOException("Error, can't make dir " + fullPath);
}
}
System.out.println("Exporting item to " + mySequenceNumber); System.out.println("Exporting item to " + mySequenceNumber);
exportItem(c, i.next(), destDirName, mySequenceNumber); exportItem(c, i.next(), fullPath, mySequenceNumber);
mySequenceNumber++; mySequenceNumber++;
} }
} }

View File

@@ -54,6 +54,7 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.Vector;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
@@ -67,6 +68,8 @@ import org.apache.commons.cli.Options;
import org.apache.commons.cli.PosixParser; import org.apache.commons.cli.PosixParser;
import org.apache.xpath.XPathAPI; import org.apache.xpath.XPathAPI;
import org.dspace.authorize.AuthorizeException; import org.dspace.authorize.AuthorizeException;
import org.dspace.authorize.AuthorizeManager;
import org.dspace.authorize.ResourcePolicy;
import org.dspace.content.Bitstream; import org.dspace.content.Bitstream;
import org.dspace.content.BitstreamFormat; import org.dspace.content.BitstreamFormat;
import org.dspace.content.Bundle; import org.dspace.content.Bundle;
@@ -74,12 +77,14 @@ import org.dspace.content.Collection;
import org.dspace.content.FormatIdentifier; import org.dspace.content.FormatIdentifier;
import org.dspace.content.InstallItem; import org.dspace.content.InstallItem;
import org.dspace.content.Item; import org.dspace.content.Item;
import org.dspace.content.MetadataField;
import org.dspace.content.MetadataSchema; import org.dspace.content.MetadataSchema;
import org.dspace.content.WorkspaceItem; import org.dspace.content.WorkspaceItem;
import org.dspace.core.ConfigurationManager; import org.dspace.core.ConfigurationManager;
import org.dspace.core.Constants; import org.dspace.core.Constants;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.eperson.EPerson; import org.dspace.eperson.EPerson;
import org.dspace.eperson.Group;
import org.dspace.handle.HandleManager; import org.dspace.handle.HandleManager;
import org.dspace.workflow.WorkflowManager; import org.dspace.workflow.WorkflowManager;
import org.w3c.dom.Document; import org.w3c.dom.Document;
@@ -170,6 +175,7 @@ public class ItemImport
String mapfile = null; String mapfile = null;
String eperson = null; // db ID or email String eperson = null; // db ID or email
String[] collections = null; // db ID or handles String[] collections = null; // db ID or handles
int status = 0;
if (line.hasOption('h')) if (line.hasOption('h'))
{ {
@@ -439,6 +445,7 @@ public class ItemImport
c.abort(); c.abort();
e.printStackTrace(); e.printStackTrace();
System.out.println(e); System.out.println(e);
status = 1;
} }
if (mapOut != null) if (mapOut != null)
@@ -450,6 +457,7 @@ public class ItemImport
{ {
System.out.println("***End of Test Run***"); System.out.println("***End of Test Run***");
} }
System.exit(status);
} }
private void addItems(Context c, Collection[] mycollections, private void addItems(Context c, Collection[] mycollections,
@@ -635,9 +643,10 @@ public class ItemImport
+ File.separatorChar); + File.separatorChar);
// and the bitstreams from the contents file // and the bitstreams from the contents file
// process contents file, add bistreams and bundles // process contents file, add bistreams and bundles, return any
processContentsFile(c, myitem, path + File.separatorChar + itemname, // non-standard permissions
"contents"); Vector options = processContentsFile(c, myitem, path
+ File.separatorChar + itemname, "contents");
if (useWorkflow) if (useWorkflow)
{ {
@@ -667,6 +676,13 @@ public class ItemImport
mapOutput = itemname + " " + myhandle; mapOutput = itemname + " " + myhandle;
} }
// set permissions if specified in contents file
if (options.size() > 0)
{
System.out.println("Processing options");
processOptions(c, myitem, options);
}
} }
// now add to multiple collections if requested // now add to multiple collections if requested
@@ -782,7 +798,7 @@ public class ItemImport
// Load all metadata schemas into the item. // Load all metadata schemas into the item.
private void loadMetadata(Context c, Item myitem, String path) private void loadMetadata(Context c, Item myitem, String path)
throws SQLException, IOException, ParserConfigurationException, throws SQLException, IOException, ParserConfigurationException,
SAXException, TransformerException SAXException, TransformerException, AuthorizeException
{ {
// Load the dublin core metadata // Load the dublin core metadata
loadDublinCore(c, myitem, path + "dublin_core.xml"); loadDublinCore(c, myitem, path + "dublin_core.xml");
@@ -798,7 +814,7 @@ public class ItemImport
private void loadDublinCore(Context c, Item myitem, String filename) private void loadDublinCore(Context c, Item myitem, String filename)
throws SQLException, IOException, ParserConfigurationException, throws SQLException, IOException, ParserConfigurationException,
SAXException, TransformerException //, AuthorizeException SAXException, TransformerException, AuthorizeException
{ {
Document document = loadXML(filename); Document document = loadXML(filename);
@@ -828,11 +844,11 @@ public class ItemImport
for (int i = 0; i < dcNodes.getLength(); i++) for (int i = 0; i < dcNodes.getLength(); i++)
{ {
Node n = dcNodes.item(i); Node n = dcNodes.item(i);
addDCValue(myitem, schema, n); addDCValue(c, myitem, schema, n);
} }
} }
private void addDCValue(Item i, String schema, Node n) throws TransformerException private void addDCValue(Context c, Item i, String schema, Node n) throws TransformerException, SQLException, AuthorizeException
{ {
String value = getStringValue(n); //n.getNodeValue(); String value = getStringValue(n); //n.getNodeValue();
// compensate for empty value getting read as "null", which won't display // compensate for empty value getting read as "null", which won't display
@@ -869,26 +885,26 @@ public class ItemImport
{ {
i.addMetadata(schema, element, qualifier, language, value); i.addMetadata(schema, element, qualifier, language, value);
} }
} else
/**
* Return the String value of a Node
*/
public String getStringValue(Node node)
{
String value = node.getNodeValue();
if (node.hasChildNodes())
{ {
Node first = node.getFirstChild(); // If we're just test the import, let's check that the actual metadata field exists.
MetadataSchema foundSchema = MetadataSchema.find(c,schema);
if (first.getNodeType() == Node.TEXT_NODE)
{ if (foundSchema == null)
return first.getNodeValue(); {
} System.out.println("ERROR: schema '"+schema+"' was not found in the registry.");
return;
}
int schemaID = foundSchema.getSchemaID();
MetadataField foundField = MetadataField.findByElement(c, schemaID, element, qualifier);
if (foundField == null)
{
System.out.println("ERROR: Metadata field: '"+schema+"."+element+"."+qualifier+"' was not found in the registry.");
return;
}
} }
return value;
} }
/** /**
@@ -940,14 +956,16 @@ public class ItemImport
/** /**
* Given a contents file and an item, stuffing it with bitstreams from the * Given a contents file and an item, stuffing it with bitstreams from the
* contents file * contents file Returns a Vector of Strings with lines from the contents
* file that request non-default bitstream permission
*/ */
private void processContentsFile(Context c, Item i, String path, private Vector processContentsFile(Context c, Item i, String path,
String filename) throws SQLException, IOException, String filename) throws SQLException, IOException,
AuthorizeException AuthorizeException
{ {
String contentspath = path + File.separatorChar + filename; String contentspath = path + File.separatorChar + filename;
String line = ""; String line = "";
Vector options = new Vector();
System.out.println("\tProcessing contents file: " + contentspath); System.out.println("\tProcessing contents file: " + contentspath);
@@ -1027,29 +1045,99 @@ public class ItemImport
continue; // process next line in contents file continue; // process next line in contents file
} }
// look for a bundle name int bitstreamEndIndex = line.indexOf("\t");
String bundleMarker = "\tbundle:";
int markerIndex = line.indexOf(bundleMarker); if (bitstreamEndIndex == -1)
if (markerIndex == -1)
{ {
// no bundle found // no extra info
processContentFileEntry(c, i, path, line, null); processContentFileEntry(c, i, path, line, null);
System.out.println("\tBitstream: " + line); System.out.println("\tBitstream: " + line);
} }
else else
{ {
// found bundle
String bundleName = line.substring(markerIndex String bitstreamName = line.substring(0, bitstreamEndIndex);
+ bundleMarker.length());
String bitstreamName = line.substring(0, markerIndex); boolean bundleExists = false;
bitstreamName = bitstreamName.trim(); boolean permissionsExist = false;
boolean descriptionExists = false;
processContentFileEntry(c, i, path, bitstreamName,
bundleName); // look for a bundle name
System.out.println("\tBitstream: " + bitstreamName String bundleMarker = "\tbundle:";
+ "\tBundle: " + bundleName); int bMarkerIndex = line.indexOf(bundleMarker);
int bEndIndex = 0;
if (bMarkerIndex > 0)
{
bEndIndex = line.indexOf("\t", bMarkerIndex + 1);
if (bEndIndex == -1)
{
bEndIndex = line.length();
}
bundleExists = true;
}
// look for permissions
String permissionsMarker = "\tpermissions:";
int pMarkerIndex = line.indexOf(permissionsMarker);
int pEndIndex = 0;
if (pMarkerIndex > 0)
{
pEndIndex = line.indexOf("\t", pMarkerIndex + 1);
if (pEndIndex == -1)
{
pEndIndex = line.length();
}
permissionsExist = true;
}
// look for descriptions
String descriptionMarker = "\tdescription:";
int dMarkerIndex = line.indexOf(descriptionMarker);
int dEndIndex = 0;
if (dMarkerIndex > 0)
{
dEndIndex = line.indexOf("\t", dMarkerIndex + 1);
if (dEndIndex == -1)
{
dEndIndex = line.length();
}
descriptionExists = true;
}
if (bundleExists)
{
String bundleName = line.substring(bMarkerIndex
+ bundleMarker.length(), bEndIndex);
processContentFileEntry(c, i, path, bitstreamName,
bundleName);
System.out.println("\tBitstream: " + bitstreamName
+ "\tBundle: " + bundleName);
}
else
{
processContentFileEntry(c, i, path, bitstreamName, null);
System.out.println("\tBitstream: " + bitstreamName);
}
if (permissionsExist || descriptionExists)
{
String extraInfo = bitstreamName;
if (permissionsExist)
{
extraInfo = extraInfo
+ line.substring(pMarkerIndex, pEndIndex);
}
if (descriptionExists)
{
extraInfo = extraInfo
+ line.substring(dMarkerIndex, dEndIndex);
}
options.add(extraInfo);
}
} }
} }
} }
@@ -1060,10 +1148,21 @@ public class ItemImport
is.close(); is.close();
} }
} }
return options;
} }
// each entry represents a bitstream.... /**
public void processContentFileEntry(Context c, Item i, String path, * each entry represents a bitstream....
* @param c
* @param i
* @param path
* @param fileName
* @param bundleName
* @throws SQLException
* @throws IOException
* @throws AuthorizeException
*/
private void processContentFileEntry(Context c, Item i, String path,
String fileName, String bundleName) throws SQLException, String fileName, String bundleName) throws SQLException,
IOException, AuthorizeException IOException, AuthorizeException
{ {
@@ -1134,7 +1233,7 @@ public class ItemImport
* @throws IOException * @throws IOException
* @throws AuthorizeException * @throws AuthorizeException
*/ */
public void registerBitstream(Context c, Item i, int assetstore, private void registerBitstream(Context c, Item i, int assetstore,
String bitstreamPath, String bundleName ) String bitstreamPath, String bundleName )
throws SQLException, IOException, AuthorizeException throws SQLException, IOException, AuthorizeException
{ {
@@ -1191,72 +1290,261 @@ public class ItemImport
} }
} }
// XML utility methods /**
public String getAttributeValue(Node n, String myattributename) *
* Process the Options to apply to the Item. The options are tab delimited
*
* Options:
* 48217870-MIT.pdf permissions: -r 'MIT Users' description: Full printable version (MIT only)
* permissions:[r|w]-['group name']
* description: 'the description of the file'
*
* where:
* [r|w] (meaning: read|write)
* ['MIT Users'] (the group name)
*
* @param c
* @param myItem
* @param options
* @throws SQLException
* @throws AuthorizeException
*/
private void processOptions(Context c, Item myItem, Vector options)
throws SQLException, AuthorizeException
{ {
String myvalue = ""; for (int i = 0; i < options.size(); i++)
{
String line = options.elementAt(i).toString();
System.out.println("\tprocessing " + line);
boolean permissionsExist = false;
boolean descriptionExists = false;
String permissionsMarker = "\tpermissions:";
int pMarkerIndex = line.indexOf(permissionsMarker);
int pEndIndex = 0;
if (pMarkerIndex > 0)
{
pEndIndex = line.indexOf("\t", pMarkerIndex + 1);
if (pEndIndex == -1)
{
pEndIndex = line.length();
}
permissionsExist = true;
}
String descriptionMarker = "\tdescription:";
int dMarkerIndex = line.indexOf(descriptionMarker);
int dEndIndex = 0;
if (dMarkerIndex > 0)
{
dEndIndex = line.indexOf("\t", dMarkerIndex + 1);
if (dEndIndex == -1)
{
dEndIndex = line.length();
}
descriptionExists = true;
}
int bsEndIndex = line.indexOf("\t");
String bitstreamName = line.substring(0, bsEndIndex);
int actionID = -1;
String groupName = "";
Group myGroup = null;
if (permissionsExist)
{
String thisPermission = line.substring(pMarkerIndex
+ permissionsMarker.length(), pEndIndex);
// get permission type ("read" or "write")
int pTypeIndex = thisPermission.indexOf("-");
// get permission group (should be in single quotes)
int groupIndex = thisPermission.indexOf("'", pTypeIndex);
int groupEndIndex = thisPermission.indexOf("'", groupIndex + 1);
// if not in single quotes, assume everything after type flag is
// group name
if (groupIndex == -1)
{
groupIndex = thisPermission.indexOf(" ", pTypeIndex);
groupEndIndex = thisPermission.length();
}
groupName = thisPermission.substring(groupIndex + 1,
groupEndIndex);
if (thisPermission.toLowerCase().charAt(pTypeIndex + 1) == 'r')
{
actionID = Constants.READ;
}
else if (thisPermission.toLowerCase().charAt(pTypeIndex + 1) == 'w')
{
actionID = Constants.WRITE;
}
try
{
myGroup = Group.findByName(c, groupName);
}
catch (SQLException sqle)
{
System.out.println("SQL Exception finding group name: "
+ groupName);
// do nothing, will check for null group later
}
}
String thisDescription = "";
if (descriptionExists)
{
thisDescription = line.substring(
dMarkerIndex + descriptionMarker.length(), dEndIndex)
.trim();
}
Bitstream bs = null;
boolean notfound = true;
if (!isTest)
{
// find bitstream
Bitstream[] bitstreams = myItem.getNonInternalBitstreams();
for (int j = 0; j < bitstreams.length && notfound; j++)
{
if (bitstreams[j].getName().equals(bitstreamName))
{
bs = bitstreams[j];
notfound = false;
}
}
}
if (notfound && !isTest)
{
// this should never happen
System.out.println("\tdefault permissions set for "
+ bitstreamName);
}
else if (!isTest)
{
if (permissionsExist)
{
if (myGroup == null)
{
System.out.println("\t" + groupName
+ " not found, permissions set to default");
}
else if (actionID == -1)
{
System.out
.println("\tinvalid permissions flag, permissions set to default");
}
else
{
System.out.println("\tSetting special permissions for "
+ bitstreamName);
setPermission(c, myGroup, actionID, bs);
}
}
if (descriptionExists)
{
System.out.println("\tSetting description for "
+ bitstreamName);
bs.setDescription(thisDescription);
bs.update();
}
}
}
}
/**
* Set the Permission on a Bitstream.
*
* @param c
* @param g
* @param actionID
* @param bs
* @throws SQLException
* @throws AuthorizeException
*/
private void setPermission(Context c, Group g, int actionID, Bitstream bs)
throws SQLException, AuthorizeException
{
if (!isTest)
{
// remove the default policy
AuthorizeManager.removeAllPolicies(c, bs);
// add the policy
ResourcePolicy rp = ResourcePolicy.create(c);
rp.setResource(bs);
rp.setAction(actionID);
rp.setGroup(g);
rp.update();
}
else
{
if (actionID == Constants.READ)
{
System.out.println("\t\tpermissions: READ for " + g.getName());
}
else if (actionID == Constants.WRITE)
{
System.out.println("\t\tpermissions: WRITE for " + g.getName());
}
}
}
// XML utility methods
/**
* Lookup an attribute from a DOM node.
* @param n
* @param name
* @return
*/
private String getAttributeValue(Node n, String name)
{
NamedNodeMap nm = n.getAttributes(); NamedNodeMap nm = n.getAttributes();
for (int i = 0; i < nm.getLength(); i++) for (int i = 0; i < nm.getLength(); i++)
{ {
Node node = nm.item(i); Node node = nm.item(i);
String name = node.getNodeName();
String value = node.getNodeValue();
if (myattributename.equals(name)) if (name.equals(node.getNodeName()))
{ {
return value; return node.getNodeValue();
} }
} }
return myvalue; return "";
} }
// XML utility methods stolen from administer.
/** /**
* Get the CDATA of a particular element. For example, if the XML document * Return the String value of a Node.
* contains: * @param node
* <P> * @return
* <code>
* &lt;foo&gt;&lt;mimetype&gt;application/pdf&lt;/mimetype&gt;&lt;/foo&gt;
* </code>
* passing this the <code>foo</code> node and <code>mimetype</code> will
* return <code>application/pdf</code>.
* </P>
* Why this isn't a core part of the XML API I do not know...
*
* @param parentElement
* the element, whose child element you want the CDATA from
* @param childName
* the name of the element you want the CDATA from
*
* @return the CDATA as a <code>String</code>
*/ */
private String getElementData(Node parentElement, String childName) private String getStringValue(Node node)
throws TransformerException
{ {
// Grab the child node String value = node.getNodeValue();
Node childNode = XPathAPI.selectSingleNode(parentElement, childName);
if (childNode == null) if (node.hasChildNodes())
{ {
// No child node, so no values Node first = node.getFirstChild();
return null;
if (first.getNodeType() == Node.TEXT_NODE)
{
return first.getNodeValue();
}
} }
// Get the #text
Node dataNode = childNode.getFirstChild();
if (dataNode == null)
{
return null;
}
// Get the data
String value = dataNode.getNodeValue().trim();
return value; return value;
} }

View File

@@ -182,7 +182,7 @@ public class BrandedPreviewJPEGFilter extends MediaFilter
Brand brand = new Brand((int) xsize, brandHeight, new Font(brandFont, Font.PLAIN, brandFontPoint), 5); Brand brand = new Brand((int) xsize, brandHeight, new Font(brandFont, Font.PLAIN, brandFontPoint), 5);
BufferedImage brandImage = brand.create(ConfigurationManager.getProperty("webui.preview.brand"), BufferedImage brandImage = brand.create(ConfigurationManager.getProperty("webui.preview.brand"),
ConfigurationManager.getProperty("webui.preview.brand.abbrev"), ConfigurationManager.getProperty("webui.preview.brand.abbrev"),
item == null ? "" : "hdl:" + item.getHandle()); MediaFilterManager.getCurrentItem() == null ? "" : "hdl:" + MediaFilterManager.getCurrentItem().getHandle());
g2d.drawImage(brandImage, (int)0, (int)ysize, (int) xsize, (int) 20, null); g2d.drawImage(brandImage, (int)0, (int)ysize, (int) xsize, (int) 20, null);

View File

@@ -0,0 +1,135 @@
/*
* FormatFilter.java
*
* Version: $Revision: 1491 $
*
* Date: $Date: 2006-03-29 21:46:42 -0500 (Wed, 29 Mar 2006) $
*
* Copyright (c) 2002-2005, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.app.mediafilter;
import java.io.InputStream;
import org.dspace.content.Bitstream;
import org.dspace.content.Item;
import org.dspace.core.Context;
/**
* Public interface for any class which transforms or converts content/bitstreams
* from one format to another. This interface should be implemented by any class
* which defines a "filter" to be run by the MediaFilterManager.
*/
public interface FormatFilter
{
/**
* Get a filename for a newly created filtered bitstream
*
* @param sourceName
* name of source bitstream
* @return filename generated by the filter - for example, document.pdf
* becomes document.pdf.txt
*/
public String getFilteredName(String sourceName);
/**
* @return name of the bundle this filter will stick its generated
* Bitstreams
*/
public String getBundleName();
/**
* @return name of the bitstream format (say "HTML" or "Microsoft Word")
* returned by this filter look in the bitstream format registry or
* mediafilter.cfg for valid format strings.
*/
public String getFormatString();
/**
* @return string to describe the newly-generated Bitstream's - how it was
* produced is a good idea
*/
public String getDescription();
/**
* @param source
* input stream
*
* @return result of filter's transformation, written out to a bitstream
*/
public InputStream getDestinationStream(InputStream source)
throws Exception;
/**
* Perform any pre-processing of the source bitstream *before* the actual
* filtering takes place in MediaFilterManager.processBitstream().
* <p>
* Return true if pre-processing is successful (or no pre-processing
* is necessary). Return false if bitstream should be skipped
* for any reason.
*
*
* @param c
* context
* @param item
* item containing bitstream to process
* @param source
* source bitstream to be processed
*
* @return true if bitstream processing should continue,
* false if this bitstream should be skipped
*/
public boolean preProcessBitstream(Context c, Item item, Bitstream source)
throws Exception;
/**
* Perform any post-processing of the generated bitstream *after* this
* filter has already been run.
* <p>
* Return true if pre-processing is successful (or no pre-processing
* is necessary). Return false if bitstream should be skipped
* for some reason.
*
*
* @param c
* context
* @param item
* item containing bitstream to process
* @param generatedBitstream
* the bitstream which was generated by
* this filter.
*/
public void postProcessBitstream(Context c, Item item, Bitstream generatedBitstream)
throws Exception;
}

View File

@@ -0,0 +1,102 @@
/*
* MediaFilter.java
*
* Version: $Revision$
*
* Date: $Date$
*
* Copyright (c) 2002-2005, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.app.mediafilter;
import org.dspace.content.Bitstream;
import org.dspace.content.Item;
import org.dspace.core.Context;
/**
* Abstract class which defines the default settings for a *simple* Media or Format Filter.
* This class may be extended by any class which wishes to define a simple filter to be run
* by the MediaFilterManager. More complex filters should likely implement the FormatFilter
* interface directly, so that they can define their own pre/postProcessing methods.
*/
public abstract class MediaFilter implements FormatFilter
{
/**
* Perform any pre-processing of the source bitstream *before* the actual
* filtering takes place in MediaFilterManager.processBitstream().
* <p>
* Return true if pre-processing is successful (or no pre-processing
* is necessary). Return false if bitstream should be skipped
* for any reason.
*
*
* @param c
* context
* @param item
* item containing bitstream to process
* @param source
* source bitstream to be processed
*
* @return true if bitstream processing should continue,
* false if this bitstream should be skipped
*/
public boolean preProcessBitstream(Context c, Item item, Bitstream source)
throws Exception
{
return true; //default to no pre-processing
}
/**
* Perform any post-processing of the generated bitstream *after* this
* filter has already been run.
* <p>
* Return true if pre-processing is successful (or no pre-processing
* is necessary). Return false if bitstream should be skipped
* for some reason.
*
*
* @param c
* context
* @param item
* item containing bitstream to process
* @param generatedBitstream
* the bitstream which was generated by
* this filter.
*/
public void postProcessBitstream(Context c, Item item, Bitstream generatedBitstream)
throws Exception
{
//default to no post-processing necessary
}
}

View File

@@ -0,0 +1,742 @@
/*
* MediaFilterManager.java
*
* Version: $Revision$
*
* Date: $Date$
*
* Copyright (c) 2002-2005, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.app.mediafilter;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.MissingArgumentException;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.PosixParser;
import org.dspace.authorize.AuthorizeManager;
import org.dspace.content.Bitstream;
import org.dspace.content.BitstreamFormat;
import org.dspace.content.Bundle;
import org.dspace.content.Collection;
import org.dspace.content.Community;
import org.dspace.content.DCDate;
import org.dspace.content.DSpaceObject;
import org.dspace.content.Item;
import org.dspace.content.ItemIterator;
import org.dspace.core.ConfigurationManager;
import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.dspace.core.PluginManager;
import org.dspace.core.SelfNamedPlugin;
import org.dspace.handle.HandleManager;
import org.dspace.search.DSIndexer;
/**
* MediaFilterManager is the class that invokes the media/format filters over the
* repository's content. a few command line flags affect the operation of the
* MFM: -v verbose outputs all extracted text to STDOUT; -f force forces all
* bitstreams to be processed, even if they have been before; -n noindex does not
* recreate index after processing bitstreams; -i [identifier] limits processing
* scope to a community, collection or item; and -m [max] limits processing to a
* maximum number of items.
*/
public class MediaFilterManager
{
//key (in dspace.cfg) which lists all enabled filters by name
public static String MEDIA_FILTER_PLUGINS_KEY = "filter.plugins";
//prefix (in dspace.cfg) for all filter properties
public static String FILTER_PREFIX = "filter";
//suffix (in dspace.cfg) for input formats supported by each filter
public static String INPUT_FORMATS_SUFFIX = "inputFormats";
public static boolean updateIndex = true; // default to updating index
public static boolean isVerbose = false; // default to not verbose
public static boolean isForce = false; // default to not forced
public static String identifier = null; // object scope limiter
public static int max2Process = Integer.MAX_VALUE; // maximum number items to process
public static int processed = 0; // number items processed
private static Item currentItem = null; // current item being processed
private static FormatFilter[] filterClasses = null;
private static Map filterFormats = new HashMap();
private static List skipList = null; //list of identifiers to skip during processing
//separator in filterFormats Map between a filter class name and a plugin name,
//for MediaFilters which extend SelfNamedPlugin (\034 is "file separator" char)
public static String FILTER_PLUGIN_SEPARATOR = "\034";
public static void main(String[] argv) throws Exception
{
// set headless for non-gui workstations
System.setProperty("java.awt.headless", "true");
// create an options object and populate it
CommandLineParser parser = new PosixParser();
int status = 0;
Options options = new Options();
options.addOption("v", "verbose", false,
"print all extracted text and other details to STDOUT");
options.addOption("f", "force", false,
"force all bitstreams to be processed");
options.addOption("n", "noindex", false,
"do NOT update the search index after filtering bitstreams");
options.addOption("i", "identifier", true,
"ONLY process bitstreams belonging to identifier");
options.addOption("m", "maximum", true,
"process no more than maximum items");
options.addOption("h", "help", false, "help");
//create a "plugin" option (to specify specific MediaFilter plugins to run)
OptionBuilder.withLongOpt("plugins");
OptionBuilder.withValueSeparator(',');
OptionBuilder.withDescription(
"ONLY run the specified Media Filter plugin(s)\n" +
"listed from '" + MEDIA_FILTER_PLUGINS_KEY + "' in dspace.cfg.\n" +
"Separate multiple with a comma (,)\n" +
"(e.g. MediaFilterManager -p \n\"Word Text Extractor\",\"PDF Text Extractor\")");
Option pluginOption = OptionBuilder.create('p');
pluginOption.setArgs(Option.UNLIMITED_VALUES); //unlimited number of args
options.addOption(pluginOption);
//create a "skip" option (to specify communities/collections/items to skip)
OptionBuilder.withLongOpt("skip");
OptionBuilder.withValueSeparator(',');
OptionBuilder.withDescription(
"SKIP the bitstreams belonging to identifier\n" +
"Separate multiple identifiers with a comma (,)\n" +
"(e.g. MediaFilterManager -s \n 123456789/34,123456789/323)");
Option skipOption = OptionBuilder.create('s');
skipOption.setArgs(Option.UNLIMITED_VALUES); //unlimited number of args
options.addOption(skipOption);
CommandLine line = null;
try
{
line = parser.parse(options, argv);
}
catch(MissingArgumentException e)
{
System.out.println("ERROR: " + e.getMessage());
HelpFormatter myhelp = new HelpFormatter();
myhelp.printHelp("MediaFilterManager\n", options);
System.exit(1);
}
if (line.hasOption('h'))
{
HelpFormatter myhelp = new HelpFormatter();
myhelp.printHelp("MediaFilterManager\n", options);
System.exit(0);
}
if (line.hasOption('v'))
{
isVerbose = true;
}
if (line.hasOption('n'))
{
updateIndex = false;
}
if (line.hasOption('f'))
{
isForce = true;
}
if (line.hasOption('i'))
{
identifier = line.getOptionValue('i');
}
if (line.hasOption('m'))
{
max2Process = Integer.parseInt(line.getOptionValue('m'));
if (max2Process <= 1)
{
System.out.println("Invalid maximum value '" +
line.getOptionValue('m') + "' - ignoring");
max2Process = Integer.MAX_VALUE;
}
}
String filterNames[] = null;
if(line.hasOption('p'))
{
//specified which media filter plugins we are using
filterNames = line.getOptionValues('p');
if(filterNames==null || filterNames.length==0)
{ //display error, since no plugins specified
System.err.println("\nERROR: -p (-plugin) option requires at least one plugin to be specified.\n" +
"(e.g. MediaFilterManager -p \"Word Text Extractor\",\"PDF Text Extractor\")\n");
HelpFormatter myhelp = new HelpFormatter();
myhelp.printHelp("MediaFilterManager\n", options);
System.exit(1);
}
}
else
{
//retrieve list of all enabled media filter plugins!
String enabledPlugins = ConfigurationManager.getProperty(MEDIA_FILTER_PLUGINS_KEY);
filterNames = enabledPlugins.split(",\\s*");
}
//initialize an array of our enabled filters
List filterList = new ArrayList();
//set up each filter
for(int i=0; i< filterNames.length; i++)
{
//get filter of this name & add to list of filters
FormatFilter filter = (FormatFilter) PluginManager.getNamedPlugin(FormatFilter.class, filterNames[i]);
if(filter==null)
{
System.err.println("\nERROR: Unknown MediaFilter specified (either from command-line or in dspace.cfg): '" + filterNames[i] + "'");
System.exit(1);
}
else
{
filterList.add(filter);
String filterClassName = filter.getClass().getName();
String pluginName = null;
//If this filter is a SelfNamedPlugin,
//then the input formats it accepts may differ for
//each "named" plugin that it defines.
//So, we have to look for every key that fits the
//following format: filter.<class-name>.<plugin-name>.inputFormats
if( SelfNamedPlugin.class.isAssignableFrom(filter.getClass()) )
{
//Get the plugin instance name for this class
pluginName = ((SelfNamedPlugin) filter).getPluginInstanceName();
}
//Retrieve our list of supported formats from dspace.cfg
//For SelfNamedPlugins, format of key is:
// filter.<class-name>.<plugin-name>.inputFormats
//For other MediaFilters, format of key is:
// filter.<class-name>.inputFormats
String formats = ConfigurationManager.getProperty(
FILTER_PREFIX + "." + filterClassName +
(pluginName!=null ? "." + pluginName : "") +
"." + INPUT_FORMATS_SUFFIX);
//add to internal map of filters to supported formats
if (formats != null)
{
//For SelfNamedPlugins, map key is:
// <class-name><separator><plugin-name>
//For other MediaFilters, map key is just:
// <class-name>
filterFormats.put(filterClassName +
(pluginName!=null ? FILTER_PLUGIN_SEPARATOR + pluginName : ""),
Arrays.asList(formats.split(",[\\s]*")));
}
}//end if filter!=null
}//end for
//If verbose, print out loaded mediafilter info
if(isVerbose)
{
System.out.println("The following MediaFilters are enabled: ");
java.util.Iterator i = filterFormats.keySet().iterator();
while(i.hasNext())
{
String filterName = (String) i.next();
System.out.println("Full Filter Name: " + filterName);
String pluginName = null;
if(filterName.contains(FILTER_PLUGIN_SEPARATOR))
{
String[] fields = filterName.split(FILTER_PLUGIN_SEPARATOR);
filterName=fields[0];
pluginName=fields[1];
}
System.out.println(filterName +
(pluginName!=null? " (Plugin: " + pluginName + ")": ""));
}
}
//store our filter list into an internal array
filterClasses = (FormatFilter[]) filterList.toArray(new FormatFilter[filterList.size()]);
//Retrieve list of identifiers to skip (if any)
String skipIds[] = null;
if(line.hasOption('s'))
{
//specified which identifiers to skip when processing
skipIds = line.getOptionValues('s');
if(skipIds==null || skipIds.length==0)
{ //display error, since no identifiers specified to skip
System.err.println("\nERROR: -s (-skip) option requires at least one identifier to SKIP.\n" +
"Make sure to separate multiple identifiers with a comma!\n" +
"(e.g. MediaFilterManager -s 123456789/34,123456789/323)\n");
HelpFormatter myhelp = new HelpFormatter();
myhelp.printHelp("MediaFilterManager\n", options);
System.exit(0);
}
//save to a global skip list
skipList = Arrays.asList(skipIds);
}
Context c = null;
try
{
c = new Context();
// have to be super-user to do the filtering
c.setIgnoreAuthorization(true);
// now apply the filters
if (identifier == null)
{
applyFiltersAllItems(c);
}
else // restrict application scope to identifier
{
DSpaceObject dso = HandleManager.resolveToObject(c, identifier);
if (dso == null)
{
throw new IllegalArgumentException("Cannot resolve "
+ identifier + " to a DSpace object");
}
switch (dso.getType())
{
case Constants.COMMUNITY:
applyFiltersCommunity(c, (Community)dso);
break;
case Constants.COLLECTION:
applyFiltersCollection(c, (Collection)dso);
break;
case Constants.ITEM:
applyFiltersItem(c, (Item)dso);
break;
}
}
// update search index?
if (updateIndex)
{
System.out.println("Updating search index:");
DSIndexer.updateIndex(c);
}
c.complete();
c = null;
}
catch (Exception e)
{
status = 1;
}
finally
{
if (c != null)
{
c.abort();
}
}
System.exit(status);
}
public static void applyFiltersAllItems(Context c) throws Exception
{
if(skipList!=null)
{
//if a skip-list exists, we need to filter community-by-community
//so we can respect what is in the skip-list
Community[] topLevelCommunities = Community.findAllTop(c);
for(int i=0; i<topLevelCommunities.length; i++)
applyFiltersCommunity(c, topLevelCommunities[i]);
}
else
{
//otherwise, just find every item and process
ItemIterator i = Item.findAll(c);
while (i.hasNext() && processed < max2Process)
{
applyFiltersItem(c, i.next());
}
}
}
public static void applyFiltersCommunity(Context c, Community community)
throws Exception
{ //only apply filters if community not in skip-list
if(!inSkipList(community.getHandle()))
{
Community[] subcommunities = community.getSubcommunities();
for (int i = 0; i < subcommunities.length; i++)
{
applyFiltersCommunity(c, subcommunities[i]);
}
Collection[] collections = community.getCollections();
for (int j = 0; j < collections.length; j++)
{
applyFiltersCollection(c, collections[j]);
}
}
}
public static void applyFiltersCollection(Context c, Collection collection)
throws Exception
{
//only apply filters if collection not in skip-list
if(!inSkipList(collection.getHandle()))
{
ItemIterator i = collection.getItems();
while (i.hasNext() && processed < max2Process)
{
applyFiltersItem(c, i.next());
}
}
}
public static void applyFiltersItem(Context c, Item item) throws Exception
{
//only apply filters if item not in skip-list
if(!inSkipList(item.getHandle()))
{
//cache this item in MediaFilterManager
//so it can be accessed by MediaFilters as necessary
currentItem = item;
if (filterItem(c, item))
{
// commit changes after each filtered item
c.commit();
// increment processed count
++processed;
}
// clear item objects from context cache and internal cache
item.decache();
currentItem = null;
}
}
/**
* iterate through the item's bitstreams in the ORIGINAL bundle, applying
* filters if possible
*
* @return true if any bitstreams processed,
* false if none
*/
public static boolean filterItem(Context c, Item myItem) throws Exception
{
// get 'original' bundles
Bundle[] myBundles = myItem.getBundles("ORIGINAL");
boolean done = false;
for (int i = 0; i < myBundles.length; i++)
{
// now look at all of the bitstreams
Bitstream[] myBitstreams = myBundles[i].getBitstreams();
for (int k = 0; k < myBitstreams.length; k++)
{
done |= filterBitstream(c, myItem, myBitstreams[k]);
}
}
return done;
}
/**
* Attempt to filter a bitstream
*
* An exception will be thrown if the media filter class cannot be
* instantiated, exceptions from filtering will be logged to STDOUT and
* swallowed.
*
* @return true if bitstream processed,
* false if no applicable filter or already processed
*/
public static boolean filterBitstream(Context c, Item myItem,
Bitstream myBitstream) throws Exception
{
boolean filtered = false;
// iterate through filter classes. A single format may be actioned
// by more than one filter
for (int i = 0; i < filterClasses.length; i++)
{
//List fmts = (List)filterFormats.get(filterClasses[i].getClass().getName());
String pluginName = null;
//if this filter class is a SelfNamedPlugin,
//its list of supported formats is different for
//differently named "plugin"
if( SelfNamedPlugin.class.isAssignableFrom(filterClasses[i].getClass()) )
{
//get plugin instance name for this media filter
pluginName = ((SelfNamedPlugin)filterClasses[i]).getPluginInstanceName();
}
//Get list of supported formats for the filter (and possibly named plugin)
//For SelfNamedPlugins, map key is:
// <class-name><separator><plugin-name>
//For other MediaFilters, map key is just:
// <class-name>
List fmts = (List)filterFormats.get(filterClasses[i].getClass().getName() +
(pluginName!=null ? FILTER_PLUGIN_SEPARATOR + pluginName : ""));
if (fmts.contains(myBitstream.getFormat().getShortDescription()))
{
try
{
// only update item if bitstream not skipped
if (processBitstream(c, myItem, myBitstream, filterClasses[i]))
{
myItem.update(); // Make sure new bitstream has a sequence
// number
filtered = true;
}
}
catch (Exception e)
{
String handle = myItem.getHandle();
Bundle[] bundles = myBitstream.getBundles();
String name = myBitstream.getName();
long size = myBitstream.getSize();
String checksum = myBitstream.getChecksum() + " ("+myBitstream.getChecksumAlgorithm()+")";
int assetstore = myBitstream.getStoreNumber();
// Printout helpfull information to find the errored bistream.
System.out.println("ERROR filtering, skipping bitstream:\n");
System.out.println("\tItem Handle: "+ handle);
for (Bundle bundle : bundles)
{
System.out.println("\tBundle Name: " + bundle.getName());
}
System.out.println("\tFile Size: " + size);
System.out.println("\tChecksum: " + checksum);
System.out.println("\tAsset Store: " + assetstore);
System.out.println(e);
e.printStackTrace();
}
}
}
return filtered;
}
/**
* processBitstream is a utility class that calls the virtual methods
* from the current MediaFilter class.
* It scans the bitstreams in an item, and decides if a bitstream has
* already been filtered, and if not or if overWrite is set, invokes the
* filter.
*
* @param c
* context
* @param item
* item containing bitstream to process
* @param source
* source bitstream to process
* @param formatFilter
* FormatFilter to perform filtering
*
* @return true if new rendition is created, false if rendition already
* exists and overWrite is not set
*/
public static boolean processBitstream(Context c, Item item, Bitstream source, FormatFilter formatFilter)
throws Exception
{
//do pre-processing of this bitstream, and if it fails, skip this bitstream!
if(!formatFilter.preProcessBitstream(c, item, source))
return false;
boolean overWrite = MediaFilterManager.isForce;
// get bitstream filename, calculate destination filename
String newName = formatFilter.getFilteredName(source.getName());
Bitstream existingBitstream = null; // is there an existing rendition?
Bundle targetBundle = null; // bundle we're modifying
Bundle[] bundles = item.getBundles(formatFilter.getBundleName());
// check if destination bitstream exists
if (bundles.length > 0)
{
// only finds the last match (FIXME?)
for (int i = 0; i < bundles.length; i++)
{
Bitstream[] bitstreams = bundles[i].getBitstreams();
for (int j = 0; j < bitstreams.length; j++)
{
if (bitstreams[j].getName().equals(newName))
{
targetBundle = bundles[i];
existingBitstream = bitstreams[j];
}
}
}
}
// if exists and overwrite = false, exit
if (!overWrite && (existingBitstream != null))
{
System.out.println("SKIPPED: bitstream " + source.getID()
+ " because '" + newName + "' already exists");
return false;
}
InputStream destStream = formatFilter.getDestinationStream(source.retrieve());
if (destStream == null)
{
System.out.println("SKIPPED: bitstream " + source.getID()
+ " because of filtering error");
return false;
}
// create new bundle if needed
if (bundles.length < 1)
{
targetBundle = item.createBundle(formatFilter.getBundleName());
}
else
{
// take the first match
targetBundle = bundles[0];
}
Bitstream b = targetBundle.createBitstream(destStream);
// Now set the format and name of the bitstream
b.setName(newName);
b.setSource("Written by FormatFilter " + formatFilter.getClass().getName() +
" on " + DCDate.getCurrent() + " (GMT).");
b.setDescription(formatFilter.getDescription());
// Find the proper format
BitstreamFormat bf = BitstreamFormat.findByShortDescription(c,
formatFilter.getFormatString());
b.setFormat(bf);
b.update();
//Inherit policies from the source bitstream
//(first remove any existing policies)
AuthorizeManager.removeAllPolicies(c, b);
AuthorizeManager.inheritPolicies(c, source, b);
// fixme - set date?
// we are overwriting, so remove old bitstream
if (existingBitstream != null)
{
targetBundle.removeBitstream(existingBitstream);
}
System.out.println("FILTERED: bitstream " + source.getID()
+ " and created '" + newName + "'");
//do post-processing of the generated bitstream
formatFilter.postProcessBitstream(c, item, b);
return true;
}
/**
* Return the item that is currently being processed/filtered
* by the MediaFilterManager
* <p>
* This allows FormatFilters to retrieve the Item object
* in case they need access to item-level information for their format
* transformations/conversions.
*
* @return current Item being processed by MediaFilterManager
*/
public static Item getCurrentItem()
{
return currentItem;
}
/**
* Check whether or not to skip processing the given identifier
*
* @param identifier
* identifier (handle) of a community, collection or item
*
* @return true if this community, collection or item should be skipped
* during processing. Otherwise, return false.
*/
public static boolean inSkipList(String identifier)
{
if(skipList!=null && skipList.contains(identifier))
{
System.out.println("SKIP-LIST: skipped bitstreams within identifier " + identifier);
return true;
}
else
return false;
}
}

View File

@@ -41,11 +41,25 @@ package org.dspace.app.mediafilter;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.InputStream; import java.io.InputStream;
import java.io.Writer;
import java.io.File;
import java.io.FileWriter;
import java.io.FileInputStream;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.io.FileOutputStream;
import java.io.CharArrayWriter;
import java.io.ByteArrayOutputStream;
import java.util.List;
import java.util.Iterator;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.pdfbox.pdfparser.PDFParser; import org.pdfbox.pdfparser.PDFParser;
import org.pdfbox.pdmodel.PDDocument; import org.pdfbox.pdmodel.PDDocument;
import org.pdfbox.pdmodel.PDPage;
import org.pdfbox.pdmodel.common.PDStream;
import org.pdfbox.util.PDFTextStripper; import org.pdfbox.util.PDFTextStripper;
import org.dspace.core.ConfigurationManager;
/* /*
* *
@@ -97,44 +111,76 @@ public class PDFFilter extends MediaFilter
public InputStream getDestinationStream(InputStream source) public InputStream getDestinationStream(InputStream source)
throws Exception throws Exception
{ {
// get input stream from bitstream
// pass to filter, get string back
PDFTextStripper pts = new PDFTextStripper();
PDFParser parser = null;
String extractedText = null;
try try
{ {
parser = new PDFParser(source); boolean useTemporaryFile = ConfigurationManager.getBooleanProperty("pdffilter.largepdfs", false);
parser.parse();
extractedText = pts.getText(new PDDocument(parser.getDocument())); // get input stream from bitstream
} // pass to filter, get string back
finally PDFTextStripper pts = new PDFTextStripper();
{ PDDocument pdfDoc = null;
Writer writer = null;
File tempTextFile = null;
ByteArrayOutputStream byteStream = null;
if (useTemporaryFile)
{
tempTextFile = File.createTempFile("dspacepdfextract" + source.hashCode(), ".txt");
tempTextFile.deleteOnExit();
writer = new OutputStreamWriter(new FileOutputStream(tempTextFile));
}
else
{
byteStream = new ByteArrayOutputStream();
writer = new OutputStreamWriter(byteStream);
}
try try
{ {
parser.getDocument().close(); pdfDoc = PDDocument.load(source);
pts.writeText(pdfDoc, writer);
} }
catch(Exception e) finally
{ {
log.error("Error closing temporary PDF file: " + e.getMessage(), e); try
{
if (pdfDoc != null)
pdfDoc.close();
}
catch(Exception e)
{
log.error("Error closing PDF file: " + e.getMessage(), e);
}
try
{
writer.close();
}
catch(Exception e)
{
log.error("Error closing temporary extract file: " + e.getMessage(), e);
}
}
if (useTemporaryFile)
{
return new FileInputStream(tempTextFile);
}
else
{
byte[] bytes = byteStream.toByteArray();
return new ByteArrayInputStream(bytes);
}
}
catch (OutOfMemoryError oome)
{
log.error("Error parsing PDF document " + oome.getMessage(), oome);
if (!ConfigurationManager.getBooleanProperty("pdffilter.skiponmemoryexception", false))
{
throw oome;
} }
} }
// if verbose flag is set, print out extracted text return null;
// to STDOUT
if (MediaFilterManager.isVerbose)
{
System.out.println(extractedText);
}
// generate an input stream with the extracted text
byte[] textBytes = extractedText.getBytes();
ByteArrayInputStream bais = new ByteArrayInputStream(textBytes);
return bais; // will this work? or will the byte array be out of scope?
} }
} }

View File

@@ -70,7 +70,7 @@ import org.dspace.core.Constants;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.core.Utils; import org.dspace.core.Utils;
import org.dspace.handle.HandleManager; import org.dspace.handle.HandleManager;
import org.dspace.app.webui.util.UIUtil; import org.dspace.app.util.Util;
import edu.harvard.hul.ois.mets.Agent; import edu.harvard.hul.ois.mets.Agent;
import edu.harvard.hul.ois.mets.AmdSec; import edu.harvard.hul.ois.mets.AmdSec;
@@ -215,6 +215,7 @@ public class METSExport
} }
context.abort(); context.abort();
System.exit(0);
} }
/** /**
@@ -409,6 +410,12 @@ public class METSExport
{ {
Bitstream[] bitstreams = bundles[i].getBitstreams(); Bitstream[] bitstreams = bundles[i].getBitstreams();
// Unusual condition, but if no bitstreams, skip this bundle
if (bitstreams.length == 0)
{
continue;
}
// First: we skip the license bundle, since it's included // First: we skip the license bundle, since it's included
// elsewhere // elsewhere
if (bitstreams[0].getFormat().getID() == licenseFormat) if (bitstreams[0].getFormat().getID() == licenseFormat)
@@ -436,7 +443,7 @@ public class METSExport
+ "/" + "/"
+ bitstreams[bits].getSequenceID() + bitstreams[bits].getSequenceID()
+ "/" + "/"
+ UIUtil.encodeBitstreamName(bitstreams[bits].getName(), + Util.encodeBitstreamName(bitstreams[bits].getName(),
"UTF-8"); "UTF-8");
edu.harvard.hul.ois.mets.File file = new edu.harvard.hul.ois.mets.File(); edu.harvard.hul.ois.mets.File file = new edu.harvard.hul.ois.mets.File();
@@ -562,10 +569,13 @@ public class METSExport
// Assume license will be in its own bundle // Assume license will be in its own bundle
Bitstream[] bitstreams = bundles[i].getBitstreams(); Bitstream[] bitstreams = bundles[i].getBitstreams();
if (bitstreams[0].getFormat().getID() == licenseFormat) if (bitstreams.length > 0)
{ {
// Read the license into a string if (bitstreams[0].getFormat().getID() == licenseFormat)
return bitstreams[0].retrieve(); {
// Read the license into a string
return bitstreams[0].retrieve();
}
} }
} }
@@ -646,9 +656,22 @@ public class METSExport
} }
else else
{ {
String value = dc[i].value;
// Replace all $'s with \$ so it doesn't trip up the replaceAll!
if (value != null && value.length() > 0)
{
// RegExp note: Yes, there really does need to be this many backslashes!
// To have \$ inserted in the replacement, both the backslash and the dollar
// have to be escaped (backslash) - so the replacemenet string has to be
// passed as \\\$. All of those backslashes then have to escaped in the literal
// for them to be in string used!!!
value = dc[i].value.replaceAll("\\$", "\\\\\\$");
}
// Replace '%s' with DC value (with entities encoded) // Replace '%s' with DC value (with entities encoded)
modsXML.append(modsMapping.replaceAll("%s", Utils modsXML.append(modsMapping.replaceAll("%s", Utils
.addEntities(dc[i].value))); .addEntities(value)));
modsXML.append("\n"); // For readability modsXML.append("\n"); // For readability
} }
} }

View File

@@ -0,0 +1,283 @@
/*
* AbstractMETSDisseminator.java
*
* Version: $Revision: 1.1 $
*
* Date: $Date: 2006/03/17 00:04:38 $
*
* Copyright (c) 2002-2006, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.app.sitemap;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Date;
import java.util.zip.GZIPOutputStream;
/**
* Base class for creating sitemaps of various kinds. A sitemap consists of one
* or more files which list significant URLs on a site for search engines to
* efficiently crawl. Dates of modification may also be included. A sitemap
* index file that links to each of the sitemap files is also generated. It is
* this index file that search engines should be directed towards.
* <P>
* Provides most of the required functionality, subclasses need just implement a
* few methods that specify the "boilerplate" and text for including URLs.
* <P>
* Typical usage:
* <pre>
* AbstractGenerator g = new FooGenerator(...);
* while (...) {
* g.addURL(url, date);
* }
* g.finish();
* </pre>
*
* @author Robert Tansley
*/
public abstract class AbstractGenerator
{
/** Number of files written so far */
protected int fileCount;
/** Number of bytes written to current file */
protected int bytesWritten;
/** Number of URLs written to current file */
protected int urlsWritten;
/** Directory files are written to */
protected File outputDir;
/** Current output */
protected PrintStream currentOutput;
/** Size in bytes of trailing boilerplate */
private int trailingByteCount;
/**
* Initialize this generator to write to the given directory. This must be
* called by any subclass constructor.
*
* @param outputDirIn
* directory to write sitemap files to
*/
public AbstractGenerator(File outputDirIn)
{
fileCount = 0;
outputDir = outputDirIn;
trailingByteCount = getTrailingBoilerPlate().length();
currentOutput = null;
}
/**
* Start writing a new sitemap file.
*
* @throws IOException
* if an error occurs creating the file
*/
protected void startNewFile() throws IOException
{
String lbp = getLeadingBoilerPlate();
OutputStream fo = new FileOutputStream(new File(outputDir,
getFilename(fileCount)));
if (useCompression())
{
fo = new GZIPOutputStream(fo);
}
currentOutput = new PrintStream(fo);
currentOutput.print(lbp);
bytesWritten = lbp.length();
urlsWritten = 0;
}
/**
* Add the given URL to the sitemap.
*
* @param url
* Full URL to add
* @param lastMod
* Date URL was last modified, or {@code null}
* @throws IOException
* if an error occurs writing
*/
public void addURL(String url, Date lastMod) throws IOException
{
// Kick things off if this is the first call
if (currentOutput == null)
{
startNewFile();
}
String newURLText = getURLText(url, lastMod);
if (bytesWritten + newURLText.length() + trailingByteCount > getMaxSize()
|| urlsWritten + 1 > getMaxURLs())
{
closeCurrentFile();
startNewFile();
}
currentOutput.print(newURLText);
bytesWritten += newURLText.length();
urlsWritten++;
}
/**
* Finish with the current sitemap file.
*
* @throws IOException
* if an error occurs writing
*/
protected void closeCurrentFile() throws IOException
{
currentOutput.print(getTrailingBoilerPlate());
currentOutput.close();
fileCount++;
}
/**
* Complete writing sitemap files and write the index files. This is invoked
* when all calls to {@link AbstractGenerator#addURL(String, Date)} have
* been completed, and invalidates the generator.
*
* @return number of sitemap files written.
*
* @throws IOException
* if an error occurs writing
*/
public int finish() throws IOException
{
closeCurrentFile();
OutputStream fo = new FileOutputStream(new File(outputDir,
getIndexFilename()));
if (useCompression())
{
fo = new GZIPOutputStream(fo);
}
PrintStream out = new PrintStream(fo);
writeIndex(out, fileCount);
out.close();
return fileCount;
}
/**
* Return marked-up text to be included in a sitemap about a given URL.
*
* @param url
* URL to add information about
* @param lastMod
* date URL was last modified, or {@code null} if unknown or not
* applicable
* @return the mark-up to include
*/
public abstract String getURLText(String url, Date lastMod);
/**
* Return the boilerplate at the top of a sitemap file.
*
* @return The boilerplate markup.
*/
public abstract String getLeadingBoilerPlate();
/**
* Return the boilerplate at the end of a sitemap file.
*
* @return The boilerplate markup.
*/
public abstract String getTrailingBoilerPlate();
/**
* Return the maximum size in bytes that an individual sitemap file should
* be.
*
* @return the size in bytes.
*/
public abstract int getMaxSize();
/**
* Return the maximum number of URLs that an individual sitemap file should
* contain.
*
* @return the maximum number of URLs.
*/
public abstract int getMaxURLs();
/**
* Return whether the written sitemap files and index should be
* GZIP-compressed.
*
* @return {@code true} if GZIP compression should be used, {@code false}
* otherwise.
*/
public abstract boolean useCompression();
/**
* Return the filename a sitemap at the given index should be stored at.
*
* @param number
* index of the sitemap file (zero is first).
* @return the filename to write the sitemap to.
*/
public abstract String getFilename(int number);
/**
* Get the filename the index should be written to.
*
* @return the filename of the index.
*/
public abstract String getIndexFilename();
/**
* Write the index file.
*
* @param output
* stream to write the index to
* @param sitemapCount
* number of sitemaps that were generated
* @throws IOException
* if an IO error occurs
*/
public abstract void writeIndex(PrintStream output, int sitemapCount)
throws IOException;
}

View File

@@ -0,0 +1,376 @@
/*
* GenerateSitemaps.java
*
* Version: $Revision: 1.1 $
*
* Date: $Date: 2006/03/17 00:04:38 $
*
* Copyright (c) 2002-2006, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.app.sitemap;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.sql.SQLException;
import java.util.Date;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
import org.apache.log4j.Logger;
import org.dspace.content.Collection;
import org.dspace.content.Community;
import org.dspace.content.Item;
import org.dspace.content.ItemIterator;
import org.dspace.core.ConfigurationManager;
import org.dspace.core.Context;
import org.dspace.core.LogManager;
/**
* Command-line utility for generating HTML and Sitemaps.org protocol Sitemaps.
*
* @author Robert Tansley
* @author Stuart Lewis
*/
public class GenerateSitemaps
{
/** Logger */
private static Logger log = Logger.getLogger(GenerateSitemaps.class);
public static void main(String[] args) throws Exception
{
final String usage = GenerateSitemaps.class.getCanonicalName();
CommandLineParser parser = new PosixParser();
HelpFormatter hf = new HelpFormatter();
Options options = new Options();
options.addOption("h", "help", false, "help");
options.addOption("s", "no_sitemaps", false,
"do not generate sitemaps.org protocol sitemap");
options.addOption("b", "no_htmlmap", false,
"do not generate a basic HTML sitemap");
options.addOption("a", "ping_all", false,
"ping configured search engines");
options
.addOption("p", "ping", true,
"ping specified search engine URL");
CommandLine line = null;
try
{
line = parser.parse(options, args);
}
catch (ParseException pe)
{
hf.printHelp(usage, options);
System.exit(1);
}
if (line.hasOption('h'))
{
hf.printHelp(usage, options);
System.exit(0);
}
if (line.getArgs().length != 0)
{
hf.printHelp(usage, options);
System.exit(1);
}
/*
* Sanity check -- if no sitemap generation or pinging to do, print
* usage
*/
if (line.getArgs().length != 0 || line.hasOption('b')
&& line.hasOption('s') && !line.hasOption('g')
&& !line.hasOption('m') && !line.hasOption('y')
&& !line.hasOption('p'))
{
System.err
.println("Nothing to do (no sitemap to generate, no search engines to ping)");
hf.printHelp(usage, options);
System.exit(1);
}
// Note the negation (CLI options indicate NOT to generate a sitemap)
if (!line.hasOption('b') || !line.hasOption('s'))
{
generateSitemaps(!line.hasOption('b'), !line.hasOption('s'));
}
if (line.hasOption('a'))
{
pingConfiguredSearchEngines();
}
if (line.hasOption('p'))
{
try
{
pingSearchEngine(line.getOptionValue('p'));
}
catch (MalformedURLException me)
{
System.err
.println("Bad search engine URL (include all except sitemap URL)");
System.exit(1);
}
}
System.exit(0);
}
/**
* Generate sitemap.org protocol and/or basic HTML sitemaps.
*
* @param makeHTMLMap
* if {@code true}, generate an HTML sitemap.
* @param makeSitemapOrg
* if {@code true}, generate an sitemap.org sitemap.
* @throws SQLException
* if a database error occurs.
* @throws IOException
* if IO error occurs.
*/
public static void generateSitemaps(boolean makeHTMLMap,
boolean makeSitemapOrg) throws SQLException, IOException
{
String sitemapStem = ConfigurationManager.getProperty("dspace.url")
+ "/sitemap";
String htmlMapStem = ConfigurationManager.getProperty("dspace.url")
+ "/htmlmap";
String handleURLStem = ConfigurationManager.getProperty("dspace.url")
+ "/handle/";
File outputDir = new File(ConfigurationManager
.getProperty("dspace.dir"), "sitemaps");
if (!outputDir.exists()) {
outputDir.mkdir();
}
AbstractGenerator html = null;
AbstractGenerator sitemapsOrg = null;
if (makeHTMLMap)
{
html = new HTMLSitemapGenerator(outputDir, htmlMapStem + "?map=",
null);
}
if (makeSitemapOrg)
{
sitemapsOrg = new SitemapsOrgGenerator(outputDir, sitemapStem
+ "?map=", null);
}
Context c = new Context();
Community[] comms = Community.findAll(c);
for (int i = 0; i < comms.length; i++)
{
String url = handleURLStem + comms[i].getHandle();
if (makeHTMLMap)
html.addURL(url, null);
if (makeSitemapOrg)
sitemapsOrg.addURL(url, null);
}
Collection[] colls = Collection.findAll(c);
for (int i = 0; i < colls.length; i++)
{
String url = handleURLStem + colls[i].getHandle();
if (makeHTMLMap)
html.addURL(url, null);
if (makeSitemapOrg)
sitemapsOrg.addURL(url, null);
}
ItemIterator allItems = Item.findAll(c);
int itemCount = 0;
while (allItems.hasNext())
{
Item i = allItems.next();
String url = handleURLStem + i.getHandle();
Date lastMod = i.getLastModified();
if (makeHTMLMap)
html.addURL(url, lastMod);
if (makeSitemapOrg)
sitemapsOrg.addURL(url, lastMod);
i.decache();
itemCount++;
}
if (makeHTMLMap)
{
int files = html.finish();
log.info(LogManager.getHeader(c, "write_sitemap",
"type=html,num_files=" + files + ",communities="
+ comms.length + ",collections=" + colls.length
+ ",items=" + itemCount));
}
if (makeSitemapOrg)
{
int files = sitemapsOrg.finish();
log.info(LogManager.getHeader(c, "write_sitemap",
"type=html,num_files=" + files + ",communities="
+ comms.length + ",collections=" + colls.length
+ ",items=" + itemCount));
}
c.abort();
}
/**
* Ping all search engines configured in {@code dspace.cfg}.
*
* @throws UnsupportedEncodingException
* theoretically should never happen
*/
public static void pingConfiguredSearchEngines()
throws UnsupportedEncodingException
{
String engineURLProp = ConfigurationManager
.getProperty("sitemap.engineurls");
String engineURLs[] = null;
if (engineURLProp != null)
{
engineURLs = engineURLProp.trim().split("\\s*,\\s*");
}
if (engineURLProp == null || engineURLs == null
|| engineURLs.length == 0 || engineURLs[0].trim().equals(""))
{
log.warn("No search engine URLs configured to ping");
return;
}
for (int i = 0; i < engineURLs.length; i++)
{
try
{
pingSearchEngine(engineURLs[i]);
}
catch (MalformedURLException me)
{
log.warn("Bad search engine URL in configuration: "
+ engineURLs[i]);
}
}
}
/**
* Ping the given search engine.
*
* @param engineURL
* Search engine URL minus protocol etc, e.g.
* {@code www.google.com}
* @return {@code true} if the operation was successful
* @throws MalformedURLException
* if the passed in URL is malformed
* @throws UnsupportedEncodingException
* theoretically should never happen
*/
public static void pingSearchEngine(String engineURL)
throws MalformedURLException, UnsupportedEncodingException
{
// Set up HTTP proxy
if ((ConfigurationManager.getProperty("http.proxy.host") != null)
&& (ConfigurationManager.getProperty("http.proxy.port") != null))
{
System.setProperty("proxySet", "true");
System.setProperty("proxyHost", ConfigurationManager
.getProperty("http.proxy.host"));
System.getProperty("proxyPort", ConfigurationManager
.getProperty("http.proxy.port"));
}
String sitemapURL = ConfigurationManager.getProperty("dspace.url")
+ "/sitemap";
URL url = new URL(engineURL + URLEncoder.encode(sitemapURL, "UTF-8"));
try
{
HttpURLConnection connection = (HttpURLConnection) url
.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(
connection.getInputStream()));
String inputLine;
StringBuffer resp = new StringBuffer();
while ((inputLine = in.readLine()) != null)
{
resp.append(inputLine).append("\n");
}
in.close();
if (connection.getResponseCode() == 200)
{
log.info("Pinged " + url.toString() + " successfully");
}
else
{
log.warn("Error response pinging " + url.toString() + ":\n"
+ resp);
}
}
catch (IOException e)
{
log.warn("Error pinging " + url.toString(), e);
}
}
}

View File

@@ -0,0 +1,146 @@
/*
* HTMLSitemapGenerator.java
*
* Version: $Revision: 1.1 $
*
* Date: $Date: 2006/03/17 00:04:38 $
*
* Copyright (c) 2002-2006, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.app.sitemap;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Date;
/**
* Class for generating HTML "sitemaps" which contain links to various pages in
* a DSpace site. This should improve search engine coverage of the DSpace site
* and limit the server load caused by crawlers.
*
* @author Robert Tansley
* @author Stuart Lewis
*/
public class HTMLSitemapGenerator extends AbstractGenerator
{
/** Stem of URLs sitemaps will eventually appear at */
private String indexURLStem;
/** Tail of URLs sitemaps will eventually appear at */
private String indexURLTail;
/**
* Construct an HTML sitemap generator, writing files to the given
* directory, and with the sitemaps eventually exposed at starting with the
* given URL stem and tail.
*
* @param outputDirIn
* Directory to write sitemap files to
* @param urlStem
* start of URL that sitemap files will appear at, e.g.
* {@code http://dspace.myu.edu/sitemap?sitemap=}
* @param urlTail
* end of URL that sitemap files will appear at, e.g.
* {@code .html} or {@code null}
*/
public HTMLSitemapGenerator(File outputDirIn, String urlStem, String urlTail)
{
super(outputDirIn);
indexURLStem = urlStem;
indexURLTail = (urlTail == null ? "" : urlTail);
}
public String getFilename(int number)
{
return "sitemap" + number + ".html";
}
public String getLeadingBoilerPlate()
{
return "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n"
+ "<HTML><HEAD><TITLE>URL List</TITLE></HEAD><BODY><UL>";
}
public int getMaxSize()
{
// 50k
return 51200;
}
public int getMaxURLs()
{
return 1000;
}
public String getTrailingBoilerPlate()
{
return "</UL></BODY></HTML>\n";
}
public String getURLText(String url, Date lastMod)
{
StringBuffer urlText = new StringBuffer();
urlText.append("<LI><A HREF=\"").append(url).append("\">").append(url)
.append("</A></LI>");
return urlText.toString();
}
public boolean useCompression()
{
return false;
}
public String getIndexFilename()
{
return "sitemap_index.html";
}
public void writeIndex(PrintStream output, int sitemapCount)
throws IOException
{
output.println(getLeadingBoilerPlate());
for (int i = 0; i < sitemapCount; i++)
{
output.print("<A HREF=\"" + indexURLStem + i + indexURLTail
+ "\">sitemap " + i);
output.print("</A></LI>");
}
output.println(getTrailingBoilerPlate());
}
}

View File

@@ -0,0 +1,161 @@
/*
* SitemapsOrgGenerator.java
*
* Version: $Revision: 1.1 $
*
* Date: $Date: 2006/03/17 00:04:38 $
*
* Copyright (c) 2002-2006, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.app.sitemap;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Class for generating <a href="http://sitemaps.org/">Sitemaps</a> to improve
* search engine coverage of the DSpace site and limit the server load caused by
* crawlers.
*
* @author Robert Tansley
* @author Stuart Lewis
*/
public class SitemapsOrgGenerator extends AbstractGenerator
{
/** Stem of URLs sitemaps will eventually appear at */
private String indexURLStem;
/** Tail of URLs sitemaps will eventually appear at */
private String indexURLTail;
/** The correct date format */
private DateFormat w3dtfFormat = new SimpleDateFormat(
"yyyy-MM-dd'T'HH:mm:ss'Z'");
/**
* Construct a sitemaps.org protocol sitemap generator, writing files to the
* given directory, and with the sitemaps eventually exposed at starting
* with the given URL stem and tail.
*
* @param outputDirIn
* Directory to write sitemap files to
* @param urlStem
* start of URL that sitemap files will appear at, e.g.
* {@code http://dspace.myu.edu/sitemap?sitemap=}
* @param urlTail
* end of URL that sitemap files will appear at, e.g.
* {@code .html} or {@code null}
*/
public SitemapsOrgGenerator(File outputDirIn, String urlStem, String urlTail)
{
super(outputDirIn);
indexURLStem = urlStem;
indexURLTail = (urlTail == null ? "" : urlTail);
}
public String getFilename(int number)
{
return "sitemap" + number + ".xml.gz";
}
public String getLeadingBoilerPlate()
{
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">";
}
public int getMaxSize()
{
// 10 Mb
return 10485760;
}
public int getMaxURLs()
{
return 50000;
}
public String getTrailingBoilerPlate()
{
return "</urlset>";
}
public String getURLText(String url, Date lastMod)
{
StringBuffer urlText = new StringBuffer();
urlText.append("<url><loc>").append(url).append("</loc>");
if (lastMod != null)
{
urlText.append("<lastmod>").append(w3dtfFormat.format(lastMod))
.append("</lastmod>");
}
urlText.append("</url>");
return urlText.toString();
}
public boolean useCompression()
{
return true;
}
public String getIndexFilename()
{
return "sitemap_index.xml.gz";
}
public void writeIndex(PrintStream output, int sitemapCount)
throws IOException
{
String now = w3dtfFormat.format(new Date());
output.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
output
.println("<sitemapindex xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">");
for (int i = 0; i < sitemapCount; i++)
{
output.print("<sitemap><loc>" + indexURLStem + i + indexURLTail
+ "</loc>");
output.print("<lastmod>" + now + "</lastmod></sitemap>");
}
output.println("</sitemapindex>");
}
}

View File

@@ -0,0 +1,422 @@
/*
* CreateStatReport.java
*
* Date: $Date: 2008-01-08
*
* Copyright (c) 2002-2008, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.app.statistics;
import java.io.File;
import java.io.FileInputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Properties;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.PosixParser;
import org.dspace.core.Context;
import org.dspace.core.ConfigurationManager;
/**
* This class allows the running of the DSpace statistic tools
*
* Usage: java CreateStatReport -r <statistic to run>
* Available: <stat-initial> <stat-general> <stat-monthly> <stat-report-initial>
* <stat-report-general> <stat-report-monthly>
*
* @author Chris Yates
*
*/
public class CreateStatReport {
/**Current date and time*/
private static Calendar calendar = null;
/**Reporting start date and time*/
private static Calendar reportStartDate = null;
/**Path of log directory*/
private static String outputLogDirectory = null;
/**Path of reporting directory*/
private static String outputReportDirectory = null;
/**File suffix for log files*/
private static String outputSuffix = ".dat";
/**User context*/
private static Context context;
/** the config file from which to configure the analyser */
private static String configFile = ConfigurationManager.getProperty("dspace.dir") +
File.separator + "config" + File.separator +
"dstat.cfg";
/*
* Main method to be run from the command line executes individual statistic methods
*
* Usage: java CreateStatReport -r <statistic to run>
*/
public static void main(String[] argv) throws Exception {
// Open the statistics config file
FileInputStream fis = new java.io.FileInputStream(new File(configFile));
Properties config = new Properties();
config.load(fis);
int startMonth = 0;
int startYear = 2005;
try
{
startYear = Integer.parseInt(config.getProperty("start.year", "1").trim());
} catch (NumberFormatException nfe)
{
System.err.println("start.year is incorrectly set in dstat.cfg. Must be a number (e.g. 2005).");
System.exit(0);
}
try
{
startMonth = Integer.parseInt(config.getProperty("start.month", "2005").trim());
} catch (NumberFormatException nfe)
{
System.err.println("start.month is incorrectly set in dstat.cfg. Must be a number between 1 and 12.");
System.exit(0);
}
reportStartDate = new GregorianCalendar(startYear, startMonth - 1, 1);
calendar = new GregorianCalendar();
// create context as super user
context = new Context();
context.setIgnoreAuthorization(true);
//get paths to directories
outputLogDirectory = ConfigurationManager.getProperty("log.dir") + File.separator;
outputReportDirectory = ConfigurationManager.getProperty("report.dir") + File.separator;
//read in command line variable to determine which statistic to run
CommandLineParser parser = new PosixParser();
Options options = new Options();
options.addOption("r", "report", true, "report");
CommandLine line = parser.parse(options, argv);
String statAction = null;
if(line.hasOption('r'))
{
statAction = line.getOptionValue('r');
}
if (statAction == null) {
usage();
System.exit(0);
}
//call appropriate statistics method
if(statAction.equals("stat-monthly")) {
statMonthly();
}
if(statAction.equals("stat-general")) {
statGeneral();
}
if(statAction.equals("stat-initial")) {
statInitial();
}
if(statAction.equals("stat-report-general")) {
statReportGeneral();
}
if(statAction.equals("stat-report-initial")) {
statReportInitial();
}
if(statAction.equals("stat-report-monthly")) {
statReportMonthly();
}
}
/**
* This method generates a report from the first of the current month to the end of the current month.
*
* @throws Exception
*/
private static void statMonthly() throws Exception {
//Output Prefix
String outputPrefix = "dspace-log-monthly-";
// set up our command line variables
String myLogDir = null;
String myFileTemplate = null;
String myConfigFile = null;
StringBuffer myOutFile = null;
Date myStartDate = null;
Date myEndDate = null;
boolean myLookUp = false;
Calendar start = new GregorianCalendar( calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
myStartDate = start.getTime();
Calendar end = new GregorianCalendar( calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
myEndDate = end.getTime();
myOutFile = new StringBuffer(outputLogDirectory);
myOutFile.append(outputPrefix);
myOutFile.append(calendar.get(Calendar.YEAR));
myOutFile.append("-");
myOutFile.append(calendar.get(Calendar.MONTH)+1);
myOutFile.append(outputSuffix);
LogAnalyser.processLogs(context, myLogDir, myFileTemplate, myConfigFile, myOutFile.toString(), myStartDate, myEndDate, myLookUp);
}
/**
* This method generates a full report based on the full log period
*
* @throws Exception
*/
private static void statGeneral() throws Exception {
//Output Prefix
String outputPrefix = "dspace-log-general-";
// set up our command line variables
String myLogDir = null;
String myFileTemplate = null;
String myConfigFile = null;
StringBuffer myOutFile = null;
Date myStartDate = null;
Date myEndDate = null;
boolean myLookUp = false;
myOutFile = new StringBuffer(outputLogDirectory);
myOutFile.append(outputPrefix);
myOutFile.append(calendar.get(Calendar.YEAR));
myOutFile.append("-");
myOutFile.append(calendar.get(Calendar.MONTH)+1);
myOutFile.append("-");
myOutFile.append(calendar.get(Calendar.DAY_OF_MONTH));
myOutFile.append(outputSuffix);
LogAnalyser.processLogs(context, myLogDir, myFileTemplate, myConfigFile, myOutFile.toString(), myStartDate, myEndDate, myLookUp);
}
/**
* This script starts from the year and month specified below and loops each month until the current month
* generating a monthly aggregation files for the DStat system.
*
* @throws Exception
*/
private static void statInitial() throws Exception {
//Output Prefix
String outputPrefix = "dspace-log-monthly-";
// set up our command line variables
String myLogDir = null;
String myFileTemplate = null;
String myConfigFile = null;
StringBuffer myOutFile = null;
Date myStartDate = null;
Date myEndDate = null;
boolean myLookUp = false;
Calendar reportEndDate = new GregorianCalendar( calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
while(reportStartDate.before(reportEndDate)) {
Calendar start = new GregorianCalendar( reportStartDate.get(Calendar.YEAR),
reportStartDate.get(Calendar.MONTH),
reportStartDate.getActualMinimum(Calendar.DAY_OF_MONTH));
myStartDate = start.getTime();
Calendar end = new GregorianCalendar( reportStartDate.get(Calendar.YEAR),
reportStartDate.get(Calendar.MONTH),
reportStartDate.getActualMaximum(Calendar.DAY_OF_MONTH));
myEndDate = end.getTime();
myOutFile = new StringBuffer(outputLogDirectory);
myOutFile.append(outputPrefix);
myOutFile.append(reportStartDate.get(Calendar.YEAR));
myOutFile.append("-");
myOutFile.append(reportStartDate.get(Calendar.MONTH)+1);
myOutFile.append(outputSuffix);
LogAnalyser.processLogs(context, myLogDir, myFileTemplate, myConfigFile, myOutFile.toString(), myStartDate, myEndDate, myLookUp);
reportStartDate.add(Calendar.MONTH, 1);
}
}
/**
* This method generates a full report based on the full log period
*
* @throws Exception
*/
private static void statReportGeneral() throws Exception {
//Prefix
String inputPrefix = "dspace-log-general-";
String outputPrefix = "report-general-";
String myFormat = "html";
StringBuffer myInput = null;
StringBuffer myOutput = null;
String myMap = null;
myInput = new StringBuffer(outputLogDirectory);
myInput.append(inputPrefix);
myInput.append(calendar.get(Calendar.YEAR));
myInput.append("-");
myInput.append(calendar.get(Calendar.MONTH)+1);
myInput.append("-");
myInput.append(calendar.get(Calendar.DAY_OF_MONTH));
myInput.append(outputSuffix);
myOutput = new StringBuffer(outputReportDirectory);
myOutput.append(outputPrefix);
myOutput.append(calendar.get(Calendar.YEAR));
myOutput.append("-");
myOutput.append(calendar.get(Calendar.MONTH)+1);
myOutput.append("-");
myOutput.append(calendar.get(Calendar.DAY_OF_MONTH));
myOutput.append(".");
myOutput.append(myFormat);
ReportGenerator.processReport(context, myFormat, myInput.toString(), myOutput.toString(), myMap);
}
/**
* This script starts from the year and month specified below and loops each month until the current month
* generating monthly reports from the DStat aggregation files
*
* @throws Exception
*/
private static void statReportInitial() throws Exception {
//Prefix
String inputPrefix = "dspace-log-monthly-";
String outputPrefix = "report-";
String myFormat = "html";
StringBuffer myInput = null;
StringBuffer myOutput = null;
String myMap = null;
Calendar reportEndDate = new GregorianCalendar( calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
while(reportStartDate.before(reportEndDate)) {
myInput = new StringBuffer(outputLogDirectory);
myInput.append(inputPrefix);
myInput.append(reportStartDate.get(Calendar.YEAR));
myInput.append("-");
myInput.append(reportStartDate.get(Calendar.MONTH)+1);
myInput.append(outputSuffix);
myOutput = new StringBuffer(outputReportDirectory);
myOutput.append(outputPrefix);
myOutput.append(reportStartDate.get(Calendar.YEAR));
myOutput.append("-");
myOutput.append(reportStartDate.get(Calendar.MONTH)+1);
myOutput.append(".");
myOutput.append(myFormat);
ReportGenerator.processReport(context, myFormat, myInput.toString(), myOutput.toString(), myMap);
reportStartDate.add(Calendar.MONTH, 1);
}
}
/**
* This method generates a report from the aggregation files which have been run for the most recent month
*
* @throws Exception
*/
private static void statReportMonthly() throws Exception
{
//Prefix
String inputPrefix = "dspace-log-monthly-";
String outputPrefix = "report-";
String myFormat = "html";
StringBuffer myInput = null;
StringBuffer myOutput = null;
String myMap = null;
myInput = new StringBuffer(outputLogDirectory);
myInput.append(inputPrefix);
myInput.append(calendar.get(Calendar.YEAR));
myInput.append("-");
myInput.append(calendar.get(Calendar.MONTH)+1);
myInput.append(outputSuffix);
myOutput = new StringBuffer(outputReportDirectory);
myOutput.append(outputPrefix);
myOutput.append(calendar.get(Calendar.YEAR));
myOutput.append("-");
myOutput.append(calendar.get(Calendar.MONTH)+1);
myOutput.append(".");
myOutput.append(myFormat);
ReportGenerator.processReport(context, myFormat, myInput.toString(), myOutput.toString(), myMap);
}
/*
* Output the usage information
*/
private static void usage() throws Exception {
System.out.println("Usage: java CreateStatReport -r <statistic to run>");
System.out.println("Available: <stat-initial> <stat-general> <stat-monthly> <stat-report-initial> <stat-report-general> <stat-report-monthly>");
return;
}
}

View File

@@ -100,19 +100,19 @@ public class LogAnalyser
///////////////// /////////////////
/** aggregator for all actions performed in the system */ /** aggregator for all actions performed in the system */
private static Map actionAggregator = new HashMap(); private static Map actionAggregator;
/** aggregator for all searches performed */ /** aggregator for all searches performed */
private static Map searchAggregator = new HashMap(); private static Map searchAggregator;
/** aggregator for user logins */ /** aggregator for user logins */
private static Map userAggregator = new HashMap(); private static Map userAggregator;
/** aggregator for item views */ /** aggregator for item views */
private static Map itemAggregator = new HashMap(); private static Map itemAggregator;
/** aggregator for current archive state statistics */ /** aggregator for current archive state statistics */
private static Map archiveStats = new HashMap(); private static Map archiveStats;
/** warning counter */ /** warning counter */
private static int warnCount = 0; private static int warnCount = 0;
@@ -125,19 +125,19 @@ public class LogAnalyser
////////////////// //////////////////
/** list of actions to be included in the general summary */ /** list of actions to be included in the general summary */
private static List generalSummary = new ArrayList(); private static List generalSummary;
/** list of words not to be aggregated */ /** list of words not to be aggregated */
private static List excludeWords = new ArrayList(); private static List excludeWords;
/** list of search types to be ignored, such as "author:" */ /** list of search types to be ignored, such as "author:" */
private static List excludeTypes = new ArrayList(); private static List excludeTypes;
/** list of characters to be excluded */ /** list of characters to be excluded */
private static List excludeChars = new ArrayList(); private static List excludeChars;
/** list of item types to be reported on in the current state */ /** list of item types to be reported on in the current state */
private static List itemTypes = new ArrayList(); private static List itemTypes;
/** bottom limit to output for search word analysis */ /** bottom limit to output for search word analysis */
private static int searchFloor; private static int searchFloor;
@@ -350,11 +350,22 @@ public class LogAnalyser
// together in a single aggregating object // together in a single aggregating object
// if the timer has not yet been started, then start it // if the timer has not yet been started, then start it
if (startTime != null) startTime = new GregorianCalendar();
{
startTime = new GregorianCalendar(); //instantiate aggregators
} actionAggregator = new HashMap();
searchAggregator = new HashMap();
userAggregator = new HashMap();
itemAggregator = new HashMap();
archiveStats = new HashMap();
//instantiate lists
generalSummary = new ArrayList();
excludeWords = new ArrayList();
excludeTypes = new ArrayList();
excludeChars = new ArrayList();
itemTypes = new ArrayList();
// set the parameters for this analysis // set the parameters for this analysis
setParameters(myLogDir, myFileTemplate, myConfigFile, myOutFile, myStartDate, myEndDate, myLookUp); setParameters(myLogDir, myFileTemplate, myConfigFile, myOutFile, myStartDate, myEndDate, myLookUp);
@@ -535,15 +546,13 @@ public class LogAnalyser
archiveStats.put(itemTypes.get(i), getNumItems(context, (String) itemTypes.get(i))); archiveStats.put(itemTypes.get(i), getNumItems(context, (String) itemTypes.get(i)));
} }
// now do the host lookup // now do the host name and url lookup
try hostName = ConfigurationManager.getProperty("dspace.hostname").trim();
name = ConfigurationManager.getProperty("dspace.name").trim();
url = ConfigurationManager.getProperty("dspace.url").trim();
if ((url != null) && (!url.endsWith("/")))
{ {
InetAddress addr = InetAddress.getLocalHost(); url = url + "/";
hostName = addr.getHostName();
}
catch (UnknownHostException e)
{
hostName = "unknown host";
} }
// do the average views analysis // do the average views analysis
@@ -767,6 +776,7 @@ public class LogAnalyser
{ {
BufferedWriter out = new BufferedWriter(new FileWriter(outFile)); BufferedWriter out = new BufferedWriter(new FileWriter(outFile));
out.write(summary.toString()); out.write(summary.toString());
out.flush();
out.close(); out.close();
} }
catch (IOException e) catch (IOException e)
@@ -910,7 +920,7 @@ public class LogAnalyser
} }
catch (IOException e) catch (IOException e)
{ {
System.out.println("Failed to read config file"); System.out.println("Failed to read config file: " + configFile);
System.exit(0); System.exit(0);
} }
@@ -975,16 +985,6 @@ public class LogAnalyser
{ {
userEmail = value; userEmail = value;
} }
if (key.equals("host.url"))
{
url = value;
}
if (key.equals("host.name"))
{
name = value;
}
} }
} }
@@ -1174,6 +1174,12 @@ public class LogAnalyser
public static Integer getNumItems(Context context, String type) public static Integer getNumItems(Context context, String type)
throws SQLException throws SQLException
{ {
boolean oracle = false;
if ("oracle".equals(ConfigurationManager.getProperty("db.name")))
{
oracle = true;
}
// FIXME: this method is clearly not optimised // FIXME: this method is clearly not optimised
// FIXME: we don't yet collect total statistics, such as number of items // FIXME: we don't yet collect total statistics, such as number of items
@@ -1197,7 +1203,16 @@ public class LogAnalyser
// start the date constraint query buffer // start the date constraint query buffer
StringBuffer dateQuery = new StringBuffer(); StringBuffer dateQuery = new StringBuffer();
dateQuery.append("SELECT item_id " + if (oracle)
{
dateQuery.append("SELECT /*+ ORDERED_PREDICATES */ item_id ");
}
else
{
dateQuery.append("SELECT item_id ");
}
dateQuery.append("FROM metadatavalue " +
"FROM metadatavalue " + "FROM metadatavalue " +
"WHERE metadata_field_id = (" + "WHERE metadata_field_id = (" +
" SELECT metadata_field_id " + " SELECT metadata_field_id " +
@@ -1207,23 +1222,41 @@ public class LogAnalyser
if (startDate != null) if (startDate != null)
{ {
dateQuery.append(" AND text_value::timestamp > '" + if (oracle)
unParseDate(startDate) + "'::timestamp "); {
dateQuery.append(" AND TO_TIMESTAMP( TO_CHAR(text_value), "+
"'yyyy-mm-dd\"T\"hh24:mi:ss\"Z\"' ) > TO_DATE('" +
unParseDate(startDate) + "', 'yyyy-MM-dd') ");
}
else
{
dateQuery.append(" AND text_value::timestamp > '" +
unParseDate(startDate) + "'::timestamp ");
}
} }
if (endDate != null) if (endDate != null)
{ {
dateQuery.append(" AND text_value::timestamp < ' " + if (oracle)
unParseDate(endDate) + "'::timestamp "); {
dateQuery.append(" AND TO_TIMESTAMP( TO_CHAR(text_value), "+
"'yyyy-mm-dd\"T\"hh24:mi:ss\"Z\"' ) < TO_DATE('" +
unParseDate(endDate) + "', 'yyyy-MM-dd') ");
}
else
{
dateQuery.append(" AND text_value::timestamp < '" +
unParseDate(endDate) + "'::timestamp ");
}
} }
// build the final query // build the final query
StringBuffer query = new StringBuffer(); StringBuffer query = new StringBuffer();
query.append("SELECT COUNT(*) AS number " + query.append("SELECT COUNT(*) AS num " +
"FROM item " + "FROM item " +
"WHERE in_archive = true " + "WHERE in_archive = " + (oracle ? "1 " : "true ") +
"AND withdrawn = false "); "AND withdrawn = " + (oracle ? "0 " : "false "));
if (startDate != null || endDate != null) if (startDate != null || endDate != null)
{ {
@@ -1239,9 +1272,18 @@ public class LogAnalyser
TableRow row = DatabaseManager.querySingle(context, query.toString()); TableRow row = DatabaseManager.querySingle(context, query.toString());
// for some reason the number column is of "long" data type! Integer numItems;
Long count = new Long(row.getLongColumn("number")); if (oracle)
return new Integer(count.intValue()); {
numItems = new Integer(row.getIntColumn("num"));
}
else
{
// for some reason the number column is of "long" data type!
Long count = new Long(row.getLongColumn("num"));
numItems = new Integer(count.intValue());
}
return numItems;
} }

View File

@@ -88,19 +88,19 @@ public class ReportGenerator
///////////////// /////////////////
/** aggregator for all actions performed in the system */ /** aggregator for all actions performed in the system */
private static Map actionAggregator = new HashMap(); private static Map actionAggregator;
/** aggregator for all searches performed */ /** aggregator for all searches performed */
private static Map searchAggregator = new HashMap(); private static Map searchAggregator;
/** aggregator for user logins */ /** aggregator for user logins */
private static Map userAggregator = new HashMap(); private static Map userAggregator;
/** aggregator for item views */ /** aggregator for item views */
private static Map itemAggregator = new HashMap(); private static Map itemAggregator;
/** aggregator for current archive state statistics */ /** aggregator for current archive state statistics */
private static Map archiveStats = new HashMap(); private static Map archiveStats;
////////////////// //////////////////
@@ -147,7 +147,7 @@ public class ReportGenerator
private static int warnings; private static int warnings;
/** the list of results to be displayed in the general summary */ /** the list of results to be displayed in the general summary */
private static List generalSummary = new ArrayList(); private static List generalSummary;
////////////////// //////////////////
// regular expressions // regular expressions
@@ -164,7 +164,7 @@ public class ReportGenerator
private static Calendar startTime = null; private static Calendar startTime = null;
/** a map from log file action to human readable action */ /** a map from log file action to human readable action */
private static Map actionMap = new HashMap(); private static Map actionMap = null;
///////////////// /////////////////
// report generator config data // report generator config data
@@ -230,7 +230,7 @@ public class ReportGenerator
System.exit(0); System.exit(0);
} }
} }
processReport(context, myFormat, myInput, myOutput, myMap); processReport(context, myFormat, myInput, myOutput, myMap);
} }
@@ -250,7 +250,18 @@ public class ReportGenerator
throws Exception, SQLException throws Exception, SQLException
{ {
startTime = new GregorianCalendar(); startTime = new GregorianCalendar();
/** instantiate aggregators */
actionAggregator = new HashMap();
searchAggregator = new HashMap();
userAggregator = new HashMap();
itemAggregator = new HashMap();
archiveStats = new HashMap();
actionMap = new HashMap();
/** instantite lists */
generalSummary = new ArrayList();
// set the parameters for this analysis // set the parameters for this analysis
setParameters(myFormat, myInput, myOutput, myMap); setParameters(myFormat, myInput, myOutput, myMap);
@@ -637,7 +648,7 @@ public class ReportGenerator
} }
catch (IOException e) catch (IOException e)
{ {
System.out.println("Failed to read input file"); System.out.println("Failed to read input file: " + input);
System.exit(0); System.exit(0);
} }
@@ -738,7 +749,7 @@ public class ReportGenerator
{ {
url = value; url = value;
} }
if (section.equals("item_lookup")) if (section.equals("item_lookup"))
{ {
itemLookup = Integer.parseInt(value); itemLookup = Integer.parseInt(value);

View File

@@ -38,7 +38,7 @@
* DAMAGE. * DAMAGE.
*/ */
package org.dspace.app.webui.util; package org.dspace.app.util;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -92,6 +92,9 @@ public class DCInput
/** the name of the controlled vocabulary to use */ /** the name of the controlled vocabulary to use */
private String vocabulary = null; private String vocabulary = null;
/** is the entry closed to vocabulary terms? */
private boolean closedVocabulary = false;
/** /**
* Class constructor for creating a DCInput object based on the contents of * Class constructor for creating a DCInput object based on the contents of
* a HashMap * a HashMap
@@ -117,7 +120,8 @@ public class DCInput
label = (String) fieldMap.get("label"); label = (String) fieldMap.get("label");
inputType = (String) fieldMap.get("input-type"); inputType = (String) fieldMap.get("input-type");
// these types are list-controlled // these types are list-controlled
if ("dropdown".equals(inputType) || "qualdrop_value".equals(inputType)) if ("dropdown".equals(inputType) || "qualdrop_value".equals(inputType)
|| "list".equals(inputType))
{ {
valueListName = (String) fieldMap.get("value-pairs-name"); valueListName = (String) fieldMap.get("value-pairs-name");
valueList = (List) listMap.get(valueListName); valueList = (List) listMap.get(valueListName);
@@ -127,6 +131,9 @@ public class DCInput
required = (warning != null && warning.length() > 0); required = (warning != null && warning.length() > 0);
visibility = (String) fieldMap.get("visibility"); visibility = (String) fieldMap.get("visibility");
vocabulary = (String) fieldMap.get("vocabulary"); vocabulary = (String) fieldMap.get("vocabulary");
String closedVocabularyStr = (String) fieldMap.get("closedVocabulary");
closedVocabulary = "true".equalsIgnoreCase(closedVocabularyStr)
|| "yes".equalsIgnoreCase(closedVocabularyStr);
} }
/** /**
@@ -203,8 +210,7 @@ public class DCInput
*/ */
public String getWarning() public String getWarning()
{ {
return "<tr><td colspan=\"4\" class=\"submitFormWarn\">" + warning return warning;
+ "</td></tr>";
} }
/** /**
@@ -234,8 +240,7 @@ public class DCInput
*/ */
public String getHints() public String getHints()
{ {
return "<tr><td colspan=\"4\" class=\"submitFormHelp\">" + hint return hint;
+ "</td></tr>";
} }
/** /**
@@ -349,4 +354,21 @@ public class DCInput
return null; return null;
} }
/**
* The closed attribute of the vocabulary tag for this field as set in
* input-forms.xml
*
* <code>
* <field>
* .....
* <vocabulary closed="true">nsrc</vocabulary>
* </field>
* </code>
* @return the closedVocabulary flags: true if the entry should be restricted
* only to vocabulary terms, false otherwise
*/
public boolean isClosedVocabulary() {
return closedVocabulary;
}
} }

View File

@@ -38,7 +38,7 @@
* DAMAGE. * DAMAGE.
*/ */
package org.dspace.app.webui.util; package org.dspace.app.util;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@@ -38,7 +38,7 @@
* DAMAGE. * DAMAGE.
*/ */
package org.dspace.app.webui.util; package org.dspace.app.util;
import java.io.File; import java.io.File;
import java.util.Vector; import java.util.Vector;
@@ -54,7 +54,6 @@ import org.apache.log4j.Logger;
import org.dspace.content.MetadataSchema; import org.dspace.content.MetadataSchema;
import org.dspace.core.ConfigurationManager; import org.dspace.core.ConfigurationManager;
import org.dspace.app.webui.servlet.SubmitServlet;
/** /**
* Submission form generator for DSpace. Reads and parses the installation * Submission form generator for DSpace. Reads and parses the installation
@@ -80,8 +79,11 @@ import org.dspace.app.webui.servlet.SubmitServlet;
public class DCInputsReader public class DCInputsReader
{ {
/** The ID of the default collection. Will never be the ID of a named collection */ /**
static final String DEFAULT_COLLECTION = "default"; * The ID of the default collection. Will never be the ID of a named
* collection
*/
public static final String DEFAULT_COLLECTION = "default";
/** Name of the form definition XML file */ /** Name of the form definition XML file */
static final String FORM_DEF_FILE = "input-forms.xml"; static final String FORM_DEF_FILE = "input-forms.xml";
@@ -93,36 +95,44 @@ public class DCInputsReader
private static Logger log = Logger.getLogger(DCInputsReader.class); private static Logger log = Logger.getLogger(DCInputsReader.class);
/** The fully qualified pathname of the form definition XML file */ /** The fully qualified pathname of the form definition XML file */
private String defsFile = ConfigurationManager.getProperty("dspace.dir") + private String defsFile = ConfigurationManager.getProperty("dspace.dir")
File.separator + "config" + File.separator + FORM_DEF_FILE; + File.separator + "config" + File.separator + FORM_DEF_FILE;
/** Reference to the collections to forms map, /**
* computed from the forms definition file * Reference to the collections to forms map, computed from the forms
* definition file
*/ */
private HashMap whichForms = null; private HashMap whichForms = null;
/** Reference to the forms definitions map, /**
* computed from the forms definition file * Reference to the forms definitions map, computed from the forms
* definition file
*/ */
private HashMap formDefns = null; private HashMap formDefns = null;
/** Reference to the value-pairs map, /**
* computed from the forms defition file * Reference to the forms which allow, disallow or mandate files to be
* uploaded.
*/
private HashMap formFileUploadDefns = null;
/**
* Reference to the value-pairs map, computed from the forms defition file
*/ */
private HashMap valuePairs = null; // Holds display/storage pairs private HashMap valuePairs = null; // Holds display/storage pairs
/** /**
* Mini-cache of last DCInputSet requested. If submissions are not * Mini-cache of last DCInputSet requested. If submissions are not typically
* typically form-interleaved, there will be a modest win. * form-interleaved, there will be a modest win.
*/ */
private DCInputSet lastInputSet = null; private DCInputSet lastInputSet = null;
/** /**
* Parse an XML encoded submission forms template file, and create * Parse an XML encoded submission forms template file, and create a hashmap
* a hashmap containing all the form information. This * containing all the form information. This hashmap will contain three top
* hashmap will contain three top level structures: a map between * level structures: a map between collections and forms, the definition for
* collections and forms, the definition for each page of each form, * each page of each form, and lists of pairs of values that populate
* and lists of pairs of values that populate selection boxes. * selection boxes.
*/ */
public DCInputsReader() public DCInputsReader()
@@ -171,11 +181,14 @@ public class DCInputsReader
} }
/** /**
* Returns the set of DC inputs used for a particular collection, * Returns the set of DC inputs used for a particular collection, or the
* or the default set if no inputs defined for the collection * default set if no inputs defined for the collection
* @param collectionHandle collection's unique Handle *
* @param collectionHandle
* collection's unique Handle
* @return DC input set * @return DC input set
* @throws ServletException if no default set defined * @throws ServletException
* if no default set defined
*/ */
public DCInputSet getInputs(String collectionHandle) public DCInputSet getInputs(String collectionHandle)
throws ServletException throws ServletException
@@ -198,7 +211,7 @@ public class DCInputsReader
Vector pages = (Vector)formDefns.get(formName); Vector pages = (Vector)formDefns.get(formName);
if ( pages == null ) if ( pages == null )
{ {
throw new ServletException("Missing the default form"); throw new ServletException("Missing the " + formName + " form");
} }
lastInputSet = new DCInputSet(formName, pages, valuePairs); lastInputSet = new DCInputSet(formName, pages, valuePairs);
return lastInputSet; return lastInputSet;
@@ -217,9 +230,9 @@ public class DCInputsReader
} }
/** /**
* Process the top level child nodes in the passed top-level node. * Process the top level child nodes in the passed top-level node. These
* These should correspond to the collection-form maps, the form * should correspond to the collection-form maps, the form definitions, and
* definitions, and the display/storage word pairs. * the display/storage word pairs.
*/ */
private void doNodes(Node n) private void doNodes(Node n)
throws SAXException, ServletException throws SAXException, ServletException
@@ -305,11 +318,11 @@ public class DCInputsReader
} }
/** /**
* Process the form-definitions section of the XML file. * Process the form-definitions section of the XML file. Each element is
* Each element is formed thusly: <form name="formname">...pages...</form> * formed thusly: <form name="formname">...pages...</form> Each pages
* Each pages subsection is formed: <page number="#"> ...fields... </page> * subsection is formed: <page number="#"> ...fields... </page> Each field
* Each field is formed from: dc-element, dc-qualifier, label, hint, * is formed from: dc-element, dc-qualifier, label, hint, input-type name,
* input-type name, required text, and repeatable flag. * required text, and repeatable flag.
*/ */
private void processDefinition(Node e) private void processDefinition(Node e)
throws SAXException, ServletException throws SAXException, ServletException
@@ -371,11 +384,6 @@ public class DCInputsReader
{ {
throw new ServletException("Form " + formName + " has no pages"); throw new ServletException("Form " + formName + " has no pages");
} }
int maxPages = SubmitServlet.EDIT_METADATA_2 - SubmitServlet.EDIT_METADATA_1 + 1;
if ( pages.size() > maxPages)
{
throw new ServletException("Form " + formName + " exceeds maximum pages: " + maxPages);
}
} }
} }
if (numForms == 0) if (numForms == 0)
@@ -405,7 +413,9 @@ public class DCInputsReader
field.put(tagName, value); field.put(tagName, value);
if (tagName.equals("input-type")) if (tagName.equals("input-type"))
{ {
if (value.equals("dropdown") || value.equals("qualdrop_value")) if (value.equals("dropdown")
|| value.equals("qualdrop_value")
|| value.equals("list"))
{ {
String pairTypeName = getAttribute(nd, PAIR_TYPE_NAME); String pairTypeName = getAttribute(nd, PAIR_TYPE_NAME);
if (pairTypeName == null) if (pairTypeName == null)
@@ -421,6 +431,11 @@ public class DCInputsReader
} }
} }
} }
else if (tagName.equals("vocabulary"))
{
String closedVocabularyString = getAttribute(nd, "closed");
field.put("closedVocabulary", closedVocabularyString);
}
} }
} }
String missing = null; String missing = null;
@@ -615,7 +630,9 @@ public class DCInputsReader
HashMap fld = (HashMap)page.get(j); HashMap fld = (HashMap)page.get(j);
// verify reference in certain input types // verify reference in certain input types
String type = (String)fld.get("input-type"); String type = (String)fld.get("input-type");
if (type.equals("dropdown") || type.equals("qualdrop_value")) if (type.equals("dropdown")
|| type.equals("qualdrop_value")
|| type.equals("list"))
{ {
String pairsName = (String)fld.get(PAIR_TYPE_NAME); String pairsName = (String)fld.get(PAIR_TYPE_NAME);
Vector v = (Vector)valuePairs.get(pairsName); Vector v = (Vector)valuePairs.get(pairsName);

View File

@@ -0,0 +1,207 @@
/*
* SubmissionConfig.java
*
* Version: $Revision$
*
* Date: $Date$
*
* Copyright (c) 2002-2005, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.app.util;
import java.util.Vector;
import java.util.Map;
import org.apache.log4j.Logger;
/**
* Class representing a single Item Submission config definition, organized into
* steps. This class represents the structure of a single 'submission-process'
* node in the item-submission.xml configuration file.
*
* @see org.dspace.app.util.SubmissionConfigReader
* @see org.dspace.app.util.SubmissionStepConfig
*
* @author Tim Donohue, based on DCInputSet by Brian S. Hughes
* @version $Revision$
*/
public class SubmissionConfig
{
/** name of the item submission process */
private String submissionName = null;
/** the configuration classes for the steps in this submission process */
private SubmissionStepConfig[] submissionSteps = null;
/** whether or not this submission process is being used in a workflow * */
private boolean isWorkflow = false;
/** log4j logger */
private static Logger log = Logger.getLogger(SubmissionConfig.class);
/**
* Constructs a new Submission Configuration object, based on the XML
* configuration file (item-submission.xml)
*
* @param submissionName
* the submission process name
* @param steps
* the vector listing of step information to build
* SubmissionStepConfig objects for this submission process
* @param isWorkflowProcess
* whether this submission process is being used in a workflow or
* not. If it is a workflow process this may limit the steps that
* are available for editing.
*/
public SubmissionConfig(String submissionName, Vector steps,
boolean isWorkflowProcess)
{
this.submissionName = submissionName;
this.isWorkflow = isWorkflowProcess;
// initialize a vector of SubmissionStepConfig objects
Vector stepConfigs = new Vector();
// loop through our steps, and create SubmissionStepConfig objects
for (int stepNum = 0; stepNum < steps.size(); stepNum++)
{
Map stepInfo = (Map) steps.get(stepNum);
SubmissionStepConfig step = new SubmissionStepConfig(stepInfo);
// Only add this step to the process if either:
// (a) this is not a workflow process OR
// (b) this is a workflow process, and this step is editable in a
// workflow
if ((!this.isWorkflow)
|| ((this.isWorkflow) && step.isWorkflowEditable()))
{
// set the number of the step (starts at 0) and add it
step.setStepNumber(stepConfigs.size());
stepConfigs.add(step);
log.debug("Added step '" + step.getProcessingClassName()
+ "' as step #" + step.getStepNumber()
+ " of submission process " + submissionName);
}
}
// get steps as an array of Strings
submissionSteps = (SubmissionStepConfig[]) stepConfigs
.toArray(new SubmissionStepConfig[0]);
}
/**
* Return the name of the item submission process definition
*
* @return the name of the submission process
*/
public String getSubmissionName()
{
return submissionName;
}
/**
* Return the number of steps in this submission process
*
* @return number of steps
*/
public int getNumberOfSteps()
{
return submissionSteps.length;
}
/**
* Return whether or not this submission process is being used in a
* workflow!
*
* @return true, if it's a workflow process. false, otherwise.
*/
public boolean isWorkflow()
{
return isWorkflow;
}
/**
* Retrieve a particular Step configuration in this Item Submission Process
* configuration. The first step is numbered "0" (although step #0 is the
* implied "select collection" step).
* <p>
* If you want to retrieve the step after the "select collection" step, you
* should retrieve step #1.
*
* If the specified step isn't found, null is returned.
*
* @param stepNum
* desired step to retrieve
*
* @return the SubmissionStepConfig object for the step
*/
public SubmissionStepConfig getStep(int stepNum)
{
if ((stepNum > submissionSteps.length - 1) || (stepNum < 0))
{
return null;
}
else
{
return submissionSteps[stepNum];
}
}
/**
* Returns whether or not there are more steps which follow the specified
* "stepNum". For example, if you specify stepNum=4, then this method checks
* to see if there is a Step #5. The first step is numbered "0".
*
* @param stepNum
* the current step.
*
* @return true, if a step at "stepNum+1" exists. false, otherwise.
*/
public boolean hasMoreSteps(int stepNum)
{
if (getStep(stepNum + 1) != null)
{
return true;
}
else
{
return false;
}
}
}

View File

@@ -0,0 +1,691 @@
/*
* SubmissionConfigReader.java
*
* Version: $Revision$
*
* Date: $Date$
*
* Copyright (c) 2002-2005, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.app.util;
import java.io.File;
import java.util.Vector;
import java.util.HashMap;
import java.util.Map;
import java.lang.Exception;
import javax.servlet.ServletException;
import org.xml.sax.SAXException;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import org.apache.log4j.Logger;
import org.dspace.core.ConfigurationManager;
/**
* Item Submission configuration generator for DSpace. Reads and parses the
* installed submission process configuration file, item-submission.xml, from
* the configuration directory. This submission process definiton details the
* ordering of the steps (and number of steps) that occur during the Item
* Submission Process. There may be multiple Item Submission processes defined,
* where each definition is assigned a unique name.
*
* The file also specifies which collections use which Item Submission process.
* At a minimum, the definitions file must define a default mapping from the
* placeholder collection # to the distinguished submission process 'default'.
* Any collections that use a custom submission process are listed paired with
* the name of the item submission process they use.
*
* @see org.dspace.app.util.SubmissionConfig
* @see org.dspace.app.util.SubmissionStepConfig
*
* @author Tim Donohue based on DCInputsReader by Brian S. Hughes
* @version $Revision$
*/
public class SubmissionConfigReader
{
/**
* The ID of the default collection. Will never be the ID of a named
* collection
*/
public static final String DEFAULT_COLLECTION = "default";
/** Prefix of the item submission definition XML file */
static final String SUBMIT_DEF_FILE_PREFIX = "item-submission";
/** Suffix of the item submission definition XML file */
static final String SUBMIT_DEF_FILE_SUFFIX = ".xml";
/** log4j logger */
private static Logger log = Logger.getLogger(SubmissionConfigReader.class);
/** The fully qualified pathname of the directory containing the Item Submission Configuration file */
private String configDir = ConfigurationManager.getProperty("dspace.dir")
+ File.separator + "config" + File.separator;
/**
* Hashmap which stores which submission process configuration is used by
* which collection, computed from the item submission config file
* (specifically, the 'submission-map' tag)
*/
private HashMap collectionToSubmissionConfig = null;
/**
* Reference to the global submission step definitions defined in the
* "step-definitions" section
*/
private HashMap stepDefns = null;
/**
* Reference to the item submission definitions defined in the
* "submission-definitions" section
*/
private HashMap submitDefns = null;
/**
* Mini-cache of last SubmissionConfig object requested (so that we don't
* always reload from scratch)
*/
private SubmissionConfig lastSubmissionConfig = null;
/**
* Load Submission Configuration from the
* item-submission.xml configuration file
*/
public SubmissionConfigReader() throws ServletException
{
buildInputs(configDir + SUBMIT_DEF_FILE_PREFIX + SUBMIT_DEF_FILE_SUFFIX);
}
/**
* Parse an XML encoded item submission configuration file.
* <P>
* Creates two main hashmaps:
* <ul>
* <li>Hashmap of Collection to Submission definition mappings -
* defines which Submission process a particular collection uses
* <li>Hashmap of all Submission definitions. List of all valid
* Submision Processes by name.
* </ul>
*/
private void buildInputs(String fileName) throws ServletException
{
collectionToSubmissionConfig = new HashMap();
submitDefns = new HashMap();
String uri = "file:" + new File(fileName).getAbsolutePath();
try
{
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
factory.setValidating(false);
factory.setIgnoringComments(true);
factory.setIgnoringElementContentWhitespace(true);
DocumentBuilder db = factory.newDocumentBuilder();
Document doc = db.parse(uri);
doNodes(doc);
}
catch (FactoryConfigurationError fe)
{
throw new ServletException(
"Cannot create Item Submission Configuration parser", fe);
}
catch (Exception e)
{
throw new ServletException(
"Error creating Item Submission Configuration: " + e);
}
}
/**
* Returns the Item Submission process config used for a particular
* collection, or the default if none is defined for the collection
*
* @param collectionHandle
* collection's unique Handle
* @param isWorkflow
* whether or not we are loading the submission process for a
* workflow
* @return the SubmissionConfig representing the item submission config
*
* @throws ServletException
* if no default submission process configuration defined
*/
public SubmissionConfig getSubmissionConfig(String collectionHandle,
boolean isWorkflow) throws ServletException
{
// get the name of the submission process config for this collection
String submitName = (String) collectionToSubmissionConfig
.get(collectionHandle);
if (submitName == null)
{
submitName = (String) collectionToSubmissionConfig
.get(DEFAULT_COLLECTION);
}
if (submitName == null)
{
throw new ServletException(
"No item submission process configuration designated as 'default' in 'submission-map' section of 'item-submission.xml'.");
}
log.debug("Loading submission process config named '" + submitName
+ "'");
// check mini-cache, and return if match
if (lastSubmissionConfig != null
&& lastSubmissionConfig.getSubmissionName().equals(submitName)
&& lastSubmissionConfig.isWorkflow() == isWorkflow)
{
log.debug("Found submission process config '" + submitName
+ "' in cache.");
return lastSubmissionConfig;
}
// cache miss - construct new SubmissionConfig
Vector steps = (Vector) submitDefns.get(submitName);
if (steps == null)
{
throw new ServletException(
"Missing the Item Submission process config '" + submitName
+ "' (or unable to load) from 'item-submission.xml'.");
}
log.debug("Submission process config '" + submitName
+ "' not in cache. Reloading from scratch.");
lastSubmissionConfig = new SubmissionConfig(submitName, steps,
isWorkflow);
log.debug("Submission process config has "
+ lastSubmissionConfig.getNumberOfSteps() + " steps listed.");
return lastSubmissionConfig;
}
/**
* Returns a particular global step definition based on its ID.
* <P>
* Global step definitions are those defined in the <step-definitions>
* section of the configuration file.
*
* @param stepID
* step's identifier
*
* @return the SubmissionStepConfig representing the step
*
* @throws ServletException
* if no default submission process configuration defined
*/
public SubmissionStepConfig getStepConfig(String stepID)
throws ServletException
{
// We should already have the step definitions loaded
if (stepDefns != null)
{
// retreive step info
Map stepInfo = (Map) stepDefns.get(stepID);
if (stepInfo != null)
return new SubmissionStepConfig(stepInfo);
}
return null;
}
/**
* Process the top level child nodes in the passed top-level node. These
* should correspond to the collection-form maps, the form definitions, and
* the display/storage word pairs.
*/
private void doNodes(Node n) throws SAXException, ServletException
{
if (n == null)
{
return;
}
Node e = getElement(n);
NodeList nl = e.getChildNodes();
int len = nl.getLength();
boolean foundMap = false;
boolean foundStepDefs = false;
boolean foundSubmitDefs = false;
for (int i = 0; i < len; i++)
{
Node nd = nl.item(i);
if ((nd == null) || isEmptyTextNode(nd))
{
continue;
}
String tagName = nd.getNodeName();
if (tagName.equals("submission-map"))
{
processMap(nd);
foundMap = true;
}
else if (tagName.equals("step-definitions"))
{
processStepDefinition(nd);
foundStepDefs = true;
}
else if (tagName.equals("submission-definitions"))
{
processSubmissionDefinition(nd);
foundSubmitDefs = true;
}
// Ignore unknown nodes
}
if (!foundMap)
{
throw new ServletException(
"No collection to item submission map ('submission-map') found in 'item-submission.xml'");
}
if (!foundStepDefs)
{
throw new ServletException("No 'step-definitions' section found in 'item-submission.xml'");
}
if (!foundSubmitDefs)
{
throw new ServletException(
"No 'submission-definitions' section found in 'item-submission.xml'");
}
}
/**
* Process the submission-map section of the XML file. Each element looks
* like: <name-map collection-handle="hdl" submission-name="name" /> Extract
* the collection handle and item submission name, put name in hashmap keyed
* by the collection handle.
*/
private void processMap(Node e) throws SAXException
{
NodeList nl = e.getChildNodes();
int len = nl.getLength();
for (int i = 0; i < len; i++)
{
Node nd = nl.item(i);
if (nd.getNodeName().equals("name-map"))
{
String id = getAttribute(nd, "collection-handle");
String value = getAttribute(nd, "submission-name");
String content = getValue(nd);
if (id == null)
{
throw new SAXException(
"name-map element is missing collection-handle attribute in 'item-submission.xml'");
}
if (value == null)
{
throw new SAXException(
"name-map element is missing submission-name attribute in 'item-submission.xml'");
}
if (content != null && content.length() > 0)
{
throw new SAXException(
"name-map element has content in 'item-submission.xml', it should be empty.");
}
collectionToSubmissionConfig.put(id, value);
} // ignore any child node that isn't a "name-map"
}
}
/**
* Process the "step-definition" section of the XML file. Each element is
* formed thusly: <step id="unique-id"> ...step_fields... </step> The valid
* step_fields are: heading, processing-servlet.
* <P>
* Extract the step information (from the step_fields) and place in a
* HashMap whose key is the step's unique id.
*/
private void processStepDefinition(Node e) throws SAXException,
ServletException
{
int numStepDefns = 0;
stepDefns = new HashMap();
NodeList nl = e.getChildNodes();
int len = nl.getLength();
for (int i = 0; i < len; i++)
{
Node nd = nl.item(i);
// process each step definition
if (nd.getNodeName().equals("step"))
{
numStepDefns++;
String stepID = getAttribute(nd, "id");
if (stepID == null)
{
throw new SAXException(
"step element has no 'id' attribute in 'item-submission.xml', which is required in the 'step-definitions' section");
}
else if (stepDefns.containsKey(stepID))
{
throw new SAXException(
"There are two step elements with the id '" + stepID + "' in 'item-submission.xml'");
}
HashMap stepInfo = processStepChildNodes("step-definition", nd);
stepDefns.put(stepID, stepInfo);
} // ignore any child that is not a 'step'
}
// Sanity check number of step definitions
if (stepDefns.size() < 1)
{
throw new ServletException(
"step-definition section has no steps! A step with id='collection' is required in 'item-submission.xml'!");
}
// Sanity check to see that the required "collection" step is defined
if (!stepDefns.containsKey(SubmissionStepConfig.SELECT_COLLECTION_STEP))
{
throw new ServletException(
"The step-definition section is REQUIRED to have a step with id='"
+ SubmissionStepConfig.SELECT_COLLECTION_STEP
+ "' in 'item-submission.xml'! This step is used to ensure that a new item submission is assigned to a collection.");
}
// Sanity check to see that the required "complete" step is defined
if (!stepDefns.containsKey(SubmissionStepConfig.COMPLETE_STEP))
{
throw new ServletException(
"The step-definition section is REQUIRED to have a step with id='"
+ SubmissionStepConfig.COMPLETE_STEP
+ "' in 'item-submission.xml'! This step is used to perform all processing necessary at the completion of the submission (e.g. starting workflow).");
}
}
/**
* Process the "submission-definition" section of the XML file. Each element
* is formed thusly: <submission-process name="submitName">...steps...</submit-process>
* Each step subsection is formed: <step> ...step_fields... </step> (with
* optional "id" attribute, to reference a step from the <step-definition>
* section). The valid step_fields are: heading, class-name.
* <P>
* Extract the submission-process name and steps and place in a HashMap
* whose key is the submission-process's unique name.
*/
private void processSubmissionDefinition(Node e) throws SAXException,
ServletException
{
int numSubmitProcesses = 0;
Vector submitNames = new Vector();
// find all child nodes of the 'submission-definition' node and loop
// through
NodeList nl = e.getChildNodes();
int len = nl.getLength();
for (int i = 0; i < len; i++)
{
Node nd = nl.item(i);
// process each 'submission-process' node
if (nd.getNodeName().equals("submission-process"))
{
numSubmitProcesses++;
String submitName = getAttribute(nd, "name");
if (submitName == null)
{
throw new SAXException(
"'submission-process' element has no 'name' attribute in 'item-submission.xml'");
}
else if (submitNames.contains(submitName))
{
throw new SAXException(
"There are two 'submission-process' elements with the name '"
+ submitName + "' in 'item-submission.xml'.");
}
submitNames.add(submitName);
// the 'submission-process' definition contains steps
Vector steps = new Vector();
submitDefns.put(submitName, steps);
// loop through all the 'step' nodes of the 'submission-process'
int stepNum = 0;
NodeList pl = nd.getChildNodes();
int lenStep = pl.getLength();
for (int j = 0; j < lenStep; j++)
{
Node nStep = pl.item(j);
stepNum++;
// process each 'step' definition
if (nStep.getNodeName().equals("step"))
{
// check for an 'id' attribute
String stepID = getAttribute(nStep, "id");
HashMap stepInfo;
// if this step has an id, load its information from the
// step-definition section
if ((stepID != null) && (stepID.length() > 0))
{
if (stepDefns.containsKey(stepID))
{
// load the step information from the
// step-definition
stepInfo = (HashMap) stepDefns.get(stepID);
}
else
{
throw new SAXException(
"The Submission process config named "
+ submitName
+ " contains a step with id="
+ stepID
+ ". There is no step with this 'id' defined in the 'step-definition' section of 'item-submission.xml'.");
}
// Ignore all children of a step element with an
// "id"
}
else
{
// get information about step from its children
// nodes
stepInfo = processStepChildNodes(
"submission-process", nStep);
}
steps.add(stepInfo);
} // ignore any child that is not a 'step'
}
// sanity check number of steps
if (steps.size() < 1)
{
throw new ServletException(
"Item Submission process config named "
+ submitName + " has no steps defined in 'item-submission.xml'");
}
// ALL Item Submission processes MUST BEGIN with selecting a
// Collection. So, automatically insert in the "collection" step
// (from the 'step-definition' section)
// Note: we already did a sanity check that this "collection"
// step exists.
steps.add(0, (HashMap) stepDefns
.get(SubmissionStepConfig.SELECT_COLLECTION_STEP));
// ALL Item Submission processes MUST END with the
// "Complete" processing step.
// So, automatically append in the "complete" step
// (from the 'step-definition' section)
// Note: we already did a sanity check that this "complete"
// step exists.
steps.add((HashMap) stepDefns
.get(SubmissionStepConfig.COMPLETE_STEP));
}
}
if (numSubmitProcesses == 0)
{
throw new ServletException(
"No 'submission-process' elements/definitions found in 'item-submission.xml'");
}
}
/**
* Process the children of the "step" tag of the XML file. Returns a HashMap
* of all the fields under that "step" tag, where the key is the field name,
* and the value is the field value.
*
*/
private HashMap processStepChildNodes(String configSection, Node nStep)
throws SAXException, ServletException
{
// initialize the HashMap of step Info
HashMap stepInfo = new HashMap();
NodeList flds = nStep.getChildNodes();
int lenflds = flds.getLength();
for (int k = 0; k < lenflds; k++)
{
// process each child node of a <step> tag
Node nfld = flds.item(k);
if (!isEmptyTextNode(nfld))
{
String tagName = nfld.getNodeName();
String value = getValue(nfld);
stepInfo.put(tagName, value);
}
}// end for each field
// check for ID attribute & save to step info
String stepID = getAttribute(nStep, "id");
if (stepID != null && stepID.length() > 0)
{
stepInfo.put("id", stepID);
}
// look for REQUIRED 'step' information
String missing = null;
if (stepInfo.get("processing-class") == null)
{
missing = "'processing-class'";
}
if (missing != null)
{
String msg = "Required field " + missing
+ " missing in a 'step' in the " + configSection
+ " of the item submission configuration file ('item-submission.xml')";
throw new SAXException(msg);
}
return stepInfo;
}
private Node getElement(Node nd)
{
NodeList nl = nd.getChildNodes();
int len = nl.getLength();
for (int i = 0; i < len; i++)
{
Node n = nl.item(i);
if (n.getNodeType() == Node.ELEMENT_NODE)
{
return n;
}
}
return null;
}
private boolean isEmptyTextNode(Node nd)
{
boolean isEmpty = false;
if (nd.getNodeType() == Node.TEXT_NODE)
{
String text = nd.getNodeValue().trim();
if (text.length() == 0)
{
isEmpty = true;
}
}
return isEmpty;
}
/**
* Returns the value of the node's attribute named <name>
*/
private String getAttribute(Node e, String name)
{
NamedNodeMap attrs = e.getAttributes();
int len = attrs.getLength();
if (len > 0)
{
int i;
for (i = 0; i < len; i++)
{
Node attr = attrs.item(i);
if (name.equals(attr.getNodeName()))
{
return attr.getNodeValue().trim();
}
}
}
// no such attribute
return null;
}
/**
* Returns the value found in the Text node (if any) in the node list that's
* passed in.
*/
private String getValue(Node nd)
{
NodeList nl = nd.getChildNodes();
int len = nl.getLength();
for (int i = 0; i < len; i++)
{
Node n = nl.item(i);
short type = n.getNodeType();
if (type == Node.TEXT_NODE)
{
return n.getNodeValue().trim();
}
}
// Didn't find a text node
return null;
}
}

View File

@@ -0,0 +1,736 @@
/*
* SubmissionInfo.java
*
* Version: $Revision$
*
* Date: $Date$
*
* Copyright (c) 2002-2005, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.app.util;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.log4j.Logger;
import org.dspace.content.Bitstream;
import org.dspace.content.Bundle;
import org.dspace.content.InProgressSubmission;
import org.dspace.submit.AbstractProcessingStep;
import org.dspace.workflow.WorkflowItem;
/**
* Information about an item being editing with the submission UI
*
* @author Robert Tansley
* @version $Revision$
*/
public class SubmissionInfo
{
/** log4j logger */
private static Logger log = Logger.getLogger(SubmissionInfo.class);
/** The item which is being submitted */
private InProgressSubmission submissionItem = null;
/**
* The Submission process config, which holds all info about the submission
* process that this item is going through (including all steps, etc)
*/
private SubmissionConfig submissionConfig = null;
/**
* Handle of the collection where this item is being submitted
*/
private String collectionHandle = null;
/***************************************************************************
* Holds all information used to build the Progress Bar in a key,value set.
* Keys are the number of the step, followed by the number of the page
* within the step (e.g. "2.1" = The first page of Step 2) (e.g. "5.2" = The
* second page of Step 5) Values are the Headings to display for each step
* (e.g. "Describe")
**************************************************************************/
private HashMap progressBar = null;
/** The element or element_qualifier to show more input boxes for */
private String moreBoxesFor;
/** The element or element_qualifier to scroll to initially using anchor */
private String jumpToField;
/** If non-empty, form-relative indices of missing fields */
private List missingFields;
/** Specific bundle we're dealing with */
private Bundle bundle;
/** Specific bitstream we're dealing with */
private Bitstream bitstream;
/** Reader for submission process configuration file * */
private static SubmissionConfigReader submissionConfigReader;
/**
* Default Constructor - PRIVATE
* <p>
* Create a SubmissionInfo object
* using the load() method!
*
*/
private SubmissionInfo()
{
}
/**
* Loads all known submission information based on the given in progress
* submission and request object.
* <P>
* If subItem is null, then just loads the default submission information
* for a new submission.
*
* @param request
* The HTTP Servlet Request object
* @param subItem
* The in-progress submission we are loading information for
*
* @return a SubmissionInfo object
*
* @throws ServletException
* if an error occurs
*/
public static SubmissionInfo load(HttpServletRequest request, InProgressSubmission subItem) throws ServletException
{
boolean forceReload = false;
SubmissionInfo subInfo = new SubmissionInfo();
// load SubmissionConfigReader only the first time
// or if we're using a different UI now.
if (submissionConfigReader == null)
{
submissionConfigReader = new SubmissionConfigReader();
forceReload=true;
}
// save the item which is going through the submission process
subInfo.setSubmissionItem(subItem);
// Only if the submission item is created can we set its collection
String collectionHandle = SubmissionConfigReader.DEFAULT_COLLECTION;
if (subItem != null)
{
collectionHandle = subItem.getCollection().getHandle();
}
// save this collection handle to this submission info object
subInfo.setCollectionHandle(collectionHandle);
// load Submission Process config for this item's collection
// (Note: this also loads the Progress Bar info, since it is
// dependent on the Submission config)
loadSubmissionConfig(request, subInfo, forceReload);
return subInfo;
}
/**
* Is this submission in the workflow process?
*
* @return true if the current submission is in the workflow process
*/
public boolean isInWorkflow()
{
return ((this.submissionItem != null) && this.submissionItem instanceof WorkflowItem);
}
/**
* Return the current in progress submission
*
* @return the InProgressSubmission object representing the current
* submission
*/
public InProgressSubmission getSubmissionItem()
{
return this.submissionItem;
}
/**
* Updates the current in progress submission item
*
* @param subItem
* the new InProgressSubmission object
*/
public void setSubmissionItem(InProgressSubmission subItem)
{
this.submissionItem = subItem;
}
/**
* Return the current submission process config (which includes all steps
* which need to be completed for the submission to be successful)
*
* @return the SubmissionConfig object, which contains info on all the steps
* in the current submission process
*/
public SubmissionConfig getSubmissionConfig()
{
return this.submissionConfig;
}
/**
* Causes the SubmissionConfig to be completely reloaded from the XML
* configuration file (item-submission.xml).
* <P>
* Note: This also reloads the progress bar info, since the progress bar
* depends entirely on the submission process (and its steps).
*
* @param request
* The HTTP Servlet Request object
*
* @throws ServletException
* if an error occurs
*/
public void reloadSubmissionConfig(HttpServletRequest request)
throws ServletException
{
// Only if the submission item is created can we set its collection
String collectionHandle = SubmissionConfigReader.DEFAULT_COLLECTION;
if (this.submissionItem != null)
{
collectionHandle = submissionItem.getCollection().getHandle();
}
this.setCollectionHandle(collectionHandle);
// force a reload of the submission process configuration
loadSubmissionConfig(request, this, true);
}
/**
* Returns a particular global step definition based on its ID.
* <P>
* Global step definitions are those defined in the <step-definitions>
* section of the configuration file.
*
* @param stepID
* step's identifier
*
* @return the SubmissionStepConfig representing the step
*
* @throws ServletException
* if no default submission process configuration defined
*/
public SubmissionStepConfig getStepConfig(String stepID)
throws ServletException
{
return submissionConfigReader.getStepConfig(stepID);
}
/**
* Return text information suitable for logging.
* <p>
* This method is used by several of the Step classes
* to log major events during the submission process (e.g. when
* license agreement was accepted, when item was submitted,
* when it was available in DSpace, etc.)
*
* @return the type and ID of the submission, bundle and/or bitstream for
* logging
*/
public String getSubmissionLogInfo()
{
String info = "";
if (isInWorkflow())
{
info = info + "workflow_id=" + getSubmissionItem().getID();
}
else
{
info = info + "workspace_item_id" + getSubmissionItem().getID();
}
if (getBundle() != null)
{
info = info + ",bundle_id=" + getBundle().getID();
}
if (getBitstream() != null)
{
info = info + ",bitstream_id=" + getBitstream().getID();
}
return info;
}
/**
* Gets the handle of the collection to which this item is being submitted
*
* @return the collection handle
*/
public String getCollectionHandle()
{
return this.collectionHandle;
}
/**
* Sets the handle of the collection to which this item is being submitted
*
* @param handle
* the new collection handle
*/
public void setCollectionHandle(String handle)
{
this.collectionHandle = handle;
}
/**
* Return the information used to build the progress bar (this includes all
* the steps in this submission, as well as the ordering and names of the
* steps).
* <p>
* Returns a Hashmap, with the following specifics:
* <p>
* Keys are the number of the step, followed by the number of the page
* within the step
* <p>
* (e.g. "2.1" = The first page of Step 2)
* <p>
* (e.g. "5.2" = The second page of Step 5)
* <P>
* Values are the Headings to display for each step (e.g. "Describe")
*
* @return a Hashmap of Progress Bar information.
*/
public Map getProgressBarInfo()
{
return this.progressBar;
}
/**
* Return the current bitstream we're working with (This is used during
* upload processes, or user interfaces that are dealing with bitstreams)
*
* @return the Bitstream object for the bitstream
*/
public Bitstream getBitstream()
{
return this.bitstream;
}
/**
* Sets the current bitstream we're working with (This is used during upload
* processes, or user interfaces that are dealing with bitstreams)
*
* @param bits
* the bitstream
*/
public void setBitstream(Bitstream bits)
{
this.bitstream = bits;
}
/**
* Return the current bundle we're working with (This is used during upload
* processes, or user interfaces that are dealing with bundles/bitstreams)
*
* @return the Bundle object for the bundle
*/
public Bundle getBundle()
{
return this.bundle;
}
/**
* Sets the current bundle we're working with (This is used during upload
* processes, or user interfaces that are dealing with bundles/bitstreams)
*
* @param bund
* the bundle
*/
public void setBundle(Bundle bund)
{
this.bundle = bund;
}
/**
* Return form related indices of the required fields which were not filled
* out by the user.
*
* @return a List of empty fields which are required
*/
public List getMissingFields()
{
return this.missingFields;
}
/**
* Sets the form related indices of the required fields which were not
* filled out by the user.
*
* @param missing
* the List of empty fields which are required
*/
public void setMissingFields(List missing)
{
this.missingFields = missing;
}
/**
* Return metadata field which user has requested more input boxes be
* displayed (by pressing "Add More" on one of the "Describe" pages)
*
* @return the String name of the field element
*/
public String getMoreBoxesFor()
{
return this.moreBoxesFor;
}
/**
* Sets the metadata field which user has requested more input boxes be
* displayed (by pressing "Add More" on one of the "Describe" pages)
*
* @param fieldname
* the name of the field element on the page
*/
public void setMoreBoxesFor(String fieldname)
{
this.moreBoxesFor = fieldname;
}
/**
* Return metadata field which JSP should "jump to" (i.e. set focus on) when
* the JSP next loads. This is used during the Describe step.
*
* @return the String name of the field element
*/
public String getJumpToField()
{
return this.jumpToField;
}
/**
* Sets metadata field which JSP should "jump to" (i.e. set focus on) when
* the JSP next loads. This is used during the Describe step.
*
* @param fieldname
* the name of the field on the page
*/
public void setJumpToField(String fieldname)
{
this.jumpToField = fieldname;
}
/**
* Load necessary information to build the Progress Bar for the Item
* Submission Progress.
*
* This information is returned in the form of a HashMap (which is then
* stored as a part of the SubmissionInfo). The HashMap takes the following
* form:
*
* Keys - the number of the step, followed by the number of the page within
* the step (e.g. "2.1" = The first page of Step 2) (e.g. "5.2" = The second
* page of Step 5)
*
* Values - the headings to display for each step (e.g. "Describe",
* "Verify")
*
* @param request
* The HTTP Servlet Request object
* @param subInfo
* the SubmissionInfo object we are loading into
* @param forceReload
* If true, this method reloads from stratch (and overwrites
* cached progress bar info)
*
*/
private static void loadProgressBar(HttpServletRequest request,
SubmissionInfo subInfo, boolean forceReload)
{
LinkedHashMap progressBarInfo = null;
log.debug("Loading Progress Bar Info");
if (!forceReload)
{
// first, attempt to load from cache
progressBarInfo = (LinkedHashMap) loadProgressBarFromCache(request
.getSession());
}
if (progressBarInfo != null && log.isDebugEnabled())
{
log.debug("Found Progress Bar Info in cache: "
+ progressBarInfo.size()
+ " pages to display in progress bar");
}
// if unable to load from cache, must load from scratch
else
{
progressBarInfo = new LinkedHashMap();
// loop through all steps
for (int i = 0; i < subInfo.submissionConfig.getNumberOfSteps(); i++)
{
// get the current step info
SubmissionStepConfig currentStep = subInfo.submissionConfig
.getStep(i);
String stepNumber = Integer.toString(currentStep
.getStepNumber());
String stepHeading = currentStep.getHeading();
// as long as this step is visible, include it in
// the Progress Bar
if (currentStep.isVisible())
{
// default to just one page in this step
int numPages = 1;
try
{
// load the processing class for this step
ClassLoader loader = subInfo.getClass()
.getClassLoader();
Class stepClass = loader.loadClass(currentStep
.getProcessingClassName());
// call the "getNumberOfPages()" method of the class
// to get it's number of pages
AbstractProcessingStep step = (AbstractProcessingStep) stepClass
.newInstance();
// get number of pages from servlet
numPages = step.getNumberOfPages(request, subInfo);
}
catch (Exception e)
{
log.error(
"Error loading progress bar information from Step Class '"
+ currentStep.getProcessingClassName()
+ "' Error:", e);
}
// save each of the step's pages to the progress bar
for (int j = 1; j <= numPages; j++)
{
String pageNumber = Integer.toString(j);
// store ("stepNumber.pageNumber", Heading) for each
// page in the step
progressBarInfo.put(stepNumber + "." + pageNumber,
stepHeading);
}// end for each page
}
}// end for each step
log.debug("Loaded Progress Bar Info from scratch: "
+ progressBarInfo.size()
+ " pages to display in progress bar");
// cache this new progress bar
saveProgressBarToCache(request.getSession(), progressBarInfo);
}// end if null
// save progressBarInfo to submission Info
subInfo.progressBar = progressBarInfo;
}
/**
* Saves all progress bar information into session cache. This saves us from
* having to reload this same progress bar over and over again.
*
* @param session
* The HTTP Session object
* @param progressBarInfo
* The progress bar info to cache
*
*/
private static void saveProgressBarToCache(HttpSession session,
HashMap progressBarInfo)
{
// cache progress bar info to Session
session.setAttribute("submission.progressbar", progressBarInfo);
}
/**
* Attempts to retrieve progress bar information (for a particular
* collection) from session cache.
*
* If the progress bar info cannot be found, returns null
*
* @param session
* The HTTP Session object
*
* @return progressBarInfo HashMap (if found), or null (if not)
*
*/
private static HashMap loadProgressBarFromCache(HttpSession session)
{
return (HashMap) session.getAttribute("submission.progressbar");
}
/**
* Loads SubmissionConfig object for the given submission info object. If a
* SubmissionConfig object cannot be loaded, a Servlet Error is thrown.
* <p>
* This method just loads this SubmissionConfig object internally, so that
* it is available via a call to "getSubmissionConfig()"
*
* @param request
* The HTTP Servlet Request object
* @param subInfo
* the SubmissionInfo object we are loading into
* @param forceReload
* If true, this method reloads from stratch (and overwrites
* cached SubmissionConfig)
*
*/
private static void loadSubmissionConfig(HttpServletRequest request,
SubmissionInfo subInfo, boolean forceReload)
throws ServletException
{
log.debug("Loading Submission Config information");
if (!forceReload)
{
// first, try to load from cache
subInfo.submissionConfig = loadSubmissionConfigFromCache(request
.getSession(), subInfo.getCollectionHandle(), subInfo
.isInWorkflow());
}
if (subInfo.submissionConfig == null || forceReload)
{
// reload the proper Submission process config
// (by reading the XML config file)
subInfo.submissionConfig = submissionConfigReader
.getSubmissionConfig(subInfo.getCollectionHandle(), subInfo
.isInWorkflow());
// cache this new submission process configuration
saveSubmissionConfigToCache(request.getSession(),
subInfo.submissionConfig, subInfo.getCollectionHandle(),
subInfo.isInWorkflow());
// also must force reload Progress Bar info,
// since it's based on the Submission config
loadProgressBar(request, subInfo, true);
}
else
{
log.debug("Found Submission Config in session cache!");
// try and reload progress bar from cache
loadProgressBar(request, subInfo, false);
}
}
/**
* Saves SubmissionConfig object into session cache. This saves us from
* having to reload this object during every "Step".
*
* @param session
* The HTTP Session object
* @param subConfig
* The SubmissionConfig to cache
* @param collectionHandle
* The Collection handle this SubmissionConfig corresponds to
* @param isWorkflow
* Whether this SubmissionConfig corresponds to a workflow
*
*
*/
private static void saveSubmissionConfigToCache(HttpSession session,
SubmissionConfig subConfig, String collectionHandle,
boolean isWorkflow)
{
// cache the submission process config
// and the collection it corresponds to
session.setAttribute("submission.config", subConfig);
session.setAttribute("submission.config.collection", collectionHandle);
session.setAttribute("submission.config.isWorkflow", new Boolean(
isWorkflow));
}
/**
* Loads SubmissionConfig object from session cache for the given
* Collection. If a SubmissionConfig object cannot be found, null is
* returned.
*
* @param session
* The HTTP Session object
* @param collectionHandle
* The Collection handle of the SubmissionConfig to load
* @param isWorkflow
* whether or not we loading the Submission process for a
* workflow item
*
* @return The cached SubmissionConfig for this collection
*/
private static SubmissionConfig loadSubmissionConfigFromCache(
HttpSession session, String collectionHandle, boolean isWorkflow)
{
// attempt to load submission process config
// from cache for the current collection
String cachedHandle = (String) session
.getAttribute("submission.config.collection");
Boolean cachedIsWorkflow = (Boolean) session
.getAttribute("submission.config.isWorkflow");
// only load from cache if the collection handle and
// workflow item status both match!
if (collectionHandle.equals(cachedHandle)
&& isWorkflow == cachedIsWorkflow.booleanValue())
{
return (SubmissionConfig) session.getAttribute("submission.config");
}
else
{
return null;
}
}
}

View File

@@ -0,0 +1,254 @@
/*
* SubmissionStepConfig.java
*
* Version: $Revision$
*
* Date: $Date$
*
* Copyright (c) 2002-2005, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.app.util;
import java.util.Map;
import org.apache.log4j.Logger;
/**
* Class representing configuration for a single step within an Item Submission
* Process. In other words, this is a single step in the SubmissionConfig class.
* This class represents the structure of a single 'step' node in the
* item-submission.xml configuration file.
*
* @see org.dspace.app.util.SubmissionConfigReader
* @see org.dspace.app.util.SubmissionConfig
*
* @author Tim Donohue
* @version $Revision$
*/
public class SubmissionStepConfig
{
/*
* The identifier for the Select Collection step
*/
public static String SELECT_COLLECTION_STEP = "collection";
/*
* The identifier for the Completion step
*/
public static String COMPLETE_STEP = "complete";
/**
* the id for this step ('id' only exists if this step is defined in the
* <step-definitions> section)
*/
private String id = null;
/** the heading for this step */
private String heading = null;
/** the name of the java processing class for this step */
private String processingClassName = null;
/** whether or not this step is editable during workflow (default=true) */
private boolean workflowEditable = true;
/**
* The full name of the JSP-UI binding class for this step. This field is
* ONLY used by the JSP-UI.
**/
private String jspBindingClassName = null;
/**
* The full name of the Manakin XML-UI Transformer class which will generate
* the necessary DRI for displaying this class in Manakin. This field is
* ONLY used by the Manakin XML-UI.
*/
private String xmlBindingClassName = null;
/** The number of this step in the current SubmissionConfig */
private int number = -1;
/** log4j logger */
private static Logger log = Logger.getLogger(SubmissionStepConfig.class);
/**
* Class constructor for creating an empty SubmissionStepConfig object
*/
public SubmissionStepConfig()
{
}
/**
* Class constructor for creating a SubmissionStepConfig object based on the
* contents of a HashMap initialized by the SubmissionConfig object.
*
* @param stepMap
* the HashMap containing all required information about this
* step
*/
public SubmissionStepConfig(Map stepMap)
{
id = (String) stepMap.get("id");
heading = (String) stepMap.get("heading");
processingClassName = (String) stepMap.get("processing-class");
jspBindingClassName = (String) stepMap.get("jspui-binding");
xmlBindingClassName = (String) stepMap.get("xmlui-binding");
String wfEditString = (String) stepMap.get("workflow-editable");
if (wfEditString != null && wfEditString.length() > 0)
{
workflowEditable = new Boolean(wfEditString).booleanValue();
}
}
/**
* Get the ID for this step. An ID is only defined if the step exists in the
* <step-definitions> section. This ID field is used to reference special
* steps (like the required step with id="collection")
*
* @return the step ID
*/
public String getId()
{
return id;
}
/**
* Get the heading for this step. This can either be a property from
* Messages.properties, or the actual heading text. If this "heading"
* contains a period(.) it is assumed to reference Messages.properties.
*
* @return the heading
*/
public String getHeading()
{
return heading;
}
/**
* Get the class which handles all processing for this step.
* <p>
* This class must extend the org.dspace.submit.AbstractProcessingStep class,
* and provide processing for BOTH the JSP-UI and XML-UI
*
* @return the class's full class path (e.g.
* "org.dspace.submit.step.MySampleStep")
*/
public String getProcessingClassName()
{
return processingClassName;
}
/**
* Retrieve the full class name of the Manakin Transformer which will
* generate this step's DRI, for display in Manakin XML-UI.
* <P>
* This class must extend the
* org.dspace.app.xmlui.aspect.submission.StepTransformer class.
* <P>
* This property is only used by the Manakin XML-UI, and therefore is not
* relevant if you are using the JSP-UI.
*
* @return the full java class name of the Transformer to use for this step
*/
public String getXMLUIClassName()
{
return xmlBindingClassName;
}
/**
* Retrieve the full class name of the JSP-UI "binding" class which will
* initialize and call the necessary JSPs for display in the JSP-UI
* <P>
* This class must extend the
* org.dspace.app.webui.submit.JSPStep class.
* <P>
* This property is only used by the JSP-UI, and therefore is not
* relevant if you are using the XML-UI (aka. Manakin).
*
* @return the full java class name of the JSPStep to use for this step
*/
public String getJSPUIClassName()
{
return jspBindingClassName;
}
/**
* Get the number of this step in the current Submission process config.
* Step numbers start with #0 (although step #0 is ALWAYS the special
* "select collection" step)
*
* @return the number of this step in the current SubmissionConfig
*/
public int getStepNumber()
{
return number;
}
/**
* Sets the number of this step in the current Submission process config.
* Step numbers start with #0 (although step #0 is ALWAYS the special
* "select collection" step)
*
* @param stepNum
* the step number.
*/
protected void setStepNumber(int stepNum)
{
this.number = stepNum;
}
/**
* Whether or not this step is editable during workflow processing. If
* "true", then this step will appear in the "Edit Metadata" stage of the
* workflow process.
*
* @return if step is editable in a workflow process
*/
public boolean isWorkflowEditable()
{
return workflowEditable;
}
/**
* Whether or not this step is visible within the Progress Bar. A step is
* only visible if it has been assigned a Heading, otherwise it's invisible
*
* @return if step is visible within the progress bar
*/
public boolean isVisible()
{
return ((heading != null) && (heading.length() > 0));
}
}

View File

@@ -0,0 +1,342 @@
/*
* Util.java
*
* Version: $Revision: $
*
* Date: $Date: $
*
* Copyright (c) 2002-2005, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.app.util;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Enumeration;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import org.dspace.core.Constants;
/**
* Miscellaneous utility methods
*
* @author Robert Tansley
* @author Mark Diggory
* @version $Revision: $
*/
public class Util {
private static Logger log = Logger.getLogger(Util.class);
/**
* Utility method to convert spaces in a string to HTML non-break space
* elements.
*
* @param s
* string to change spaces in
* @return the string passed in with spaces converted to HTML non-break
* spaces
*/
public static String nonBreakSpace(String s) {
StringBuffer newString = new StringBuffer();
for (int i = 0; i < s.length(); i++)
{
char ch = s.charAt(i);
if (ch == ' ')
{
newString.append("&nbsp;");
}
else
{
newString.append(ch);
}
}
return newString.toString();
}
/**
* Encode a bitstream name for inclusion in a URL in an HTML document. This
* differs from the usual URL-encoding, since we want pathname separators to
* be passed through verbatim; this is required so that relative paths in
* bitstream names and HTML references work correctly.
* <P>
* If the link to a bitstream is generated with the pathname separators
* escaped (e.g. "%2F" instead of "/") then the Web user agent perceives it
* to be one pathname element, and relative URI paths within that document
* containing ".." elements will be handled incorrectly.
* <P>
*
* @param stringIn
* input string to encode
* @param encoding
* character encoding, e.g. UTF-8
* @return the encoded string
*/
public static String encodeBitstreamName(String stringIn, String encoding) throws java.io.UnsupportedEncodingException {
// FIXME: This should be moved elsewhere, as it is used outside the UI
StringBuffer out = new StringBuffer();
final String[] pctEncoding = { "%00", "%01", "%02", "%03", "%04",
"%05", "%06", "%07", "%08", "%09", "%0a", "%0b", "%0c", "%0d",
"%0e", "%0f", "%10", "%11", "%12", "%13", "%14", "%15", "%16",
"%17", "%18", "%19", "%1a", "%1b", "%1c", "%1d", "%1e", "%1f",
"%20", "%21", "%22", "%23", "%24", "%25", "%26", "%27", "%28",
"%29", "%2a", "%2b", "%2c", "%2d", "%2e", "%2f", "%30", "%31",
"%32", "%33", "%34", "%35", "%36", "%37", "%38", "%39", "%3a",
"%3b", "%3c", "%3d", "%3e", "%3f", "%40", "%41", "%42", "%43",
"%44", "%45", "%46", "%47", "%48", "%49", "%4a", "%4b", "%4c",
"%4d", "%4e", "%4f", "%50", "%51", "%52", "%53", "%54", "%55",
"%56", "%57", "%58", "%59", "%5a", "%5b", "%5c", "%5d", "%5e",
"%5f", "%60", "%61", "%62", "%63", "%64", "%65", "%66", "%67",
"%68", "%69", "%6a", "%6b", "%6c", "%6d", "%6e", "%6f", "%70",
"%71", "%72", "%73", "%74", "%75", "%76", "%77", "%78", "%79",
"%7a", "%7b", "%7c", "%7d", "%7e", "%7f", "%80", "%81", "%82",
"%83", "%84", "%85", "%86", "%87", "%88", "%89", "%8a", "%8b",
"%8c", "%8d", "%8e", "%8f", "%90", "%91", "%92", "%93", "%94",
"%95", "%96", "%97", "%98", "%99", "%9a", "%9b", "%9c", "%9d",
"%9e", "%9f", "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6",
"%a7", "%a8", "%a9", "%aa", "%ab", "%ac", "%ad", "%ae", "%af",
"%b0", "%b1", "%b2", "%b3", "%b4", "%b5", "%b6", "%b7", "%b8",
"%b9", "%ba", "%bb", "%bc", "%bd", "%be", "%bf", "%c0", "%c1",
"%c2", "%c3", "%c4", "%c5", "%c6", "%c7", "%c8", "%c9", "%ca",
"%cb", "%cc", "%cd", "%ce", "%cf", "%d0", "%d1", "%d2", "%d3",
"%d4", "%d5", "%d6", "%d7", "%d8", "%d9", "%da", "%db", "%dc",
"%dd", "%de", "%df", "%e0", "%e1", "%e2", "%e3", "%e4", "%e5",
"%e6", "%e7", "%e8", "%e9", "%ea", "%eb", "%ec", "%ed", "%ee",
"%ef", "%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7",
"%f8", "%f9", "%fa", "%fb", "%fc", "%fd", "%fe", "%ff" };
byte[] bytes = stringIn.getBytes(encoding);
for (int i = 0; i < bytes.length; i++)
{
// Any unreserved char or "/" goes through unencoded
if ((bytes[i] >= 'A' && bytes[i] <= 'Z')
|| (bytes[i] >= 'a' && bytes[i] <= 'z')
|| (bytes[i] >= '0' && bytes[i] <= '9') || bytes[i] == '-'
|| bytes[i] == '.' || bytes[i] == '_' || bytes[i] == '~'
|| bytes[i] == '/')
{
out.append((char) bytes[i]);
}
else if (bytes[i] >= 0)
{
// encode other chars (byte code < 128)
out.append(pctEncoding[bytes[i]]);
}
else
{
// encode other chars (byte code > 127, so it appears as
// negative in Java signed byte data type)
out.append(pctEncoding[256 + bytes[i]]);
}
}
log.debug("encoded \"" + stringIn + "\" to \"" + out.toString() + "\"");
return out.toString();
}
/** Version of encodeBitstreamName with one parameter, uses default encoding
* <P>
* @param stringIn
* input string to encode
* @return the encoded string
*/
public static String encodeBitstreamName(String stringIn) throws java.io.UnsupportedEncodingException {
return encodeBitstreamName(stringIn, Constants.DEFAULT_ENCODING);
}
/**
* Formats the file size. Examples:
*
* - 50 = 50B
* - 1024 = 1KB
* - 1,024,000 = 1MB etc
*
* The numbers are formatted using java Locales
*
* @param in The number to covnert
* @return the file size as a String
*/
public static String formatFileSize(double in) {
// Work out the size of the file, and format appropriatly
// FIXME: When full i18n support is available, use the user's Locale
// rather than the default Locale.
NumberFormat nf = NumberFormat.getNumberInstance(Locale.getDefault());
DecimalFormat df = (DecimalFormat)nf;
df.applyPattern("###,###.##");
if (in < 1024)
{
df.applyPattern("0");
return df.format(in) + " " + "B";
}
else if (in < 1024000)
{
in = in / 1024;
return df.format(in) + " " + "kB";
}
else if (in < 1024000000)
{
in = in / 1024000;
return df.format(in) + " " + "MB";
}
else
{
in = in / 1024000000;
return df.format(in) + " " + "GB";
}
}
/**
* Obtain a parameter from the given request as an int. <code>-1</code> is
* returned if the parameter is garbled or does not exist.
*
* @param request
* the HTTP request
* @param param
* the name of the parameter
*
* @return the integer value of the parameter, or -1
*/
public static int getIntParameter(HttpServletRequest request, String param)
{
String val = request.getParameter(param);
try
{
return Integer.parseInt(val.trim());
}
catch (Exception e)
{
// Problem with parameter
return -1;
}
}
/**
* Obtain an array of int parameters from the given request as an int. null
* is returned if parameter doesn't exist. <code>-1</code> is returned in
* array locations if that particular value is garbled.
*
* @param request
* the HTTP request
* @param param
* the name of the parameter
*
* @return array of integers or null
*/
public static int[] getIntParameters(HttpServletRequest request,
String param)
{
String[] request_values = request.getParameterValues(param);
if (request_values == null)
{
return null;
}
int[] return_values = new int[request_values.length];
for (int x = 0; x < return_values.length; x++)
{
try
{
return_values[x] = Integer.parseInt(request_values[x]);
}
catch (Exception e)
{
// Problem with parameter, stuff -1 in this slot
return_values[x] = -1;
}
}
return return_values;
}
/**
* Obtain a parameter from the given request as a boolean.
* <code>false</code> is returned if the parameter is garbled or does not
* exist.
*
* @param request
* the HTTP request
* @param param
* the name of the parameter
*
* @return the integer value of the parameter, or -1
*/
public static boolean getBoolParameter(HttpServletRequest request,
String param)
{
return ((request.getParameter(param) != null) && request.getParameter(
param).equals("true"));
}
/**
* Get the button the user pressed on a submitted form. All buttons should
* start with the text <code>submit</code> for this to work. A default
* should be supplied, since often the browser will submit a form with no
* submit button pressed if the user presses enter.
*
* @param request
* the HTTP request
* @param def
* the default button
*
* @return the button pressed
*/
public static String getSubmitButton(HttpServletRequest request, String def)
{
Enumeration e = request.getParameterNames();
while (e.hasMoreElements())
{
String parameterName = (String) e.nextElement();
if (parameterName.startsWith("submit"))
{
return parameterName;
}
}
return def;
}
}

View File

@@ -37,7 +37,7 @@
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE. * DAMAGE.
*/ */
package org.dspace.eperson; package org.dspace.authenticate;
import java.io.IOException; import java.io.IOException;
@@ -58,7 +58,6 @@ import org.dspace.core.Context;
import org.dspace.core.PluginManager; import org.dspace.core.PluginManager;
import org.dspace.core.LogManager; import org.dspace.core.LogManager;
import org.dspace.eperson.EPerson; import org.dspace.eperson.EPerson;
import org.dspace.eperson.AuthenticationMethod;
/** /**
* Access point for the stackable authentication methods. * Access point for the stackable authentication methods.
@@ -299,6 +298,7 @@ public class AuthenticationManager
*/ */
public static int[] getSpecialGroups(Context context, public static int[] getSpecialGroups(Context context,
HttpServletRequest request) HttpServletRequest request)
throws SQLException
{ {
ArrayList gll = new ArrayList(); ArrayList gll = new ArrayList();
int totalLen = 0; int totalLen = 0;

View File

@@ -37,7 +37,7 @@
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE. * DAMAGE.
*/ */
package org.dspace.eperson; package org.dspace.authenticate;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -183,7 +183,8 @@ public interface AuthenticationMethod {
* @return array of EPerson-group IDs, possibly 0-length, but * @return array of EPerson-group IDs, possibly 0-length, but
* never <code>null</code>. * never <code>null</code>.
*/ */
public int[] getSpecialGroups(Context context, HttpServletRequest request); public int[] getSpecialGroups(Context context, HttpServletRequest request)
throws SQLException;
/** /**
* Authenticate the given or implicit credentials. * Authenticate the given or implicit credentials.

View File

@@ -0,0 +1,274 @@
/*
* IPAuthentication.java
*
* Version: $Revision$
*
* Date: $Date$
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.authenticate;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.dspace.core.ConfigurationManager;
import org.dspace.core.Context;
import org.dspace.core.LogManager;
import org.dspace.eperson.EPerson;
import org.dspace.eperson.Group;
/**
* Adds users to special groups based on IP address. Configuration parameter
* form is:
* <P>
* {@code authentication.ip.<GROUPNAME> = <IPRANGE>[, <IPRANGE> ...]}
* <P>
* e.g. {@code authentication.ip.MIT = 18., 192.25.0.0/255.255.0.0}
* <P>
* For supported IP ranges see {@link org.dspace.authenticate.IPMatcher}.
*
* @version $Revision$
* @author Robert Tansley
*/
public class IPAuthentication implements AuthenticationMethod
{
/** Our logger */
private static Logger log = Logger.getLogger(IPAuthentication.class);
/** All the IP matchers */
private List<IPMatcher> ipMatchers;
/**
* Maps IPMatchers to group names when we don't know group DB ID yet. When
* the DB ID is known, the IPMatcher is moved to ipMatcherGroupIDs and then
* points to the DB ID.
*/
private Map<IPMatcher, String> ipMatcherGroupNames;
/** Maps IPMatchers to group IDs (Integers) where we know the group DB ID */
private Map<IPMatcher, Integer> ipMatcherGroupIDs;
/**
* Initialize an IP authenticator, reading in the configuration. Note this
* will never fail if the configuration is bad -- a warning will be logged.
*/
public IPAuthentication()
{
ipMatchers = new ArrayList<IPMatcher>();
ipMatcherGroupIDs = new HashMap<IPMatcher, Integer>();
ipMatcherGroupNames = new HashMap<IPMatcher, String>();
Enumeration e = ConfigurationManager.propertyNames();
while (e.hasMoreElements())
{
String propName = (String) e.nextElement();
if (propName.startsWith("authentication.ip."))
{
String[] nameParts = propName.split("\\.");
if (nameParts.length == 3)
{
addMatchers(nameParts[2], ConfigurationManager
.getProperty(propName));
}
else
{
log.warn("Malformed configuration property name: "
+ propName);
}
}
}
}
/**
* Add matchers for the given comma-delimited IP ranges and group.
*
* @param groupName
* name of group
* @param ipRanges
* IP ranges
*/
private void addMatchers(String groupName, String ipRanges)
{
String[] ranges = ipRanges.split("\\s*,\\s*");
for (int i = 0; i < ranges.length; i++)
{
try
{
IPMatcher ipm = new IPMatcher(ranges[i]);
ipMatchers.add(ipm);
ipMatcherGroupNames.put(ipm, groupName);
if (log.isDebugEnabled())
{
log.debug("Configured " + ranges[i] + " for special group "
+ groupName);
}
}
catch (IPMatcherException ipme)
{
log.warn("Malformed IP range specified for group " + groupName,
ipme);
}
}
}
public boolean canSelfRegister(Context context, HttpServletRequest request,
String username) throws SQLException
{
return false;
}
public void initEPerson(Context context, HttpServletRequest request,
EPerson eperson) throws SQLException
{
}
public boolean allowSetPassword(Context context,
HttpServletRequest request, String username) throws SQLException
{
return false;
}
public boolean isImplicit()
{
return true;
}
public int[] getSpecialGroups(Context context, HttpServletRequest request)
throws SQLException
{
List<Integer> groupIDs = new ArrayList<Integer>();
String addr = request.getRemoteAddr();
for (int i = 0; i < ipMatchers.size(); i++)
{
IPMatcher ipm = ipMatchers.get(i);
try
{
if (ipm.match(addr))
{
// Do we know group ID?
Integer g = ipMatcherGroupIDs.get(ipm);
if (g != null)
{
groupIDs.add(g);
}
else
{
// See if we have a group name
String groupName = ipMatcherGroupNames.get(ipm);
if (groupName != null)
{
Group group = Group.findByName(context, groupName);
if (group != null)
{
// Add ID so we won't have to do lookup again
ipMatcherGroupIDs.put(ipm, new Integer(group
.getID()));
ipMatcherGroupNames.remove(ipm);
groupIDs.add(new Integer(group.getID()));
}
else
{
log.warn(LogManager.getHeader(context,
"configuration_error", "unknown_group="
+ groupName));
}
}
}
}
}
catch (IPMatcherException ipme)
{
log.warn(LogManager.getHeader(context, "configuration_error",
"bad_ip=" + addr), ipme);
}
}
int[] results = new int[groupIDs.size()];
for (int i = 0; i < groupIDs.size(); i++)
{
results[i] = (groupIDs.get(i)).intValue();
}
if (log.isDebugEnabled())
{
StringBuffer gsb = new StringBuffer();
for (int i = 0; i < results.length; i++)
{
if (i > 0)
gsb.append(",");
gsb.append(results[i]);
}
log.debug(LogManager.getHeader(context, "authenticated",
"special_groups=" + gsb.toString()));
}
return results;
}
public int authenticate(Context context, String username, String password,
String realm, HttpServletRequest request) throws SQLException
{
return BAD_ARGS;
}
public String loginPageURL(Context context, HttpServletRequest request,
HttpServletResponse response)
{
return null;
}
public String loginPageTitle(Context context)
{
return null;
}
}

View File

@@ -0,0 +1,231 @@
/*
* IPMatcher.java
*
* Version: $Revision$
*
* Date: $Date$
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.authenticate;
/**
* Quickly tests whether a given IPv4 4-byte address matches an IP range. An
* {@code IPMatcher} is initialized with a particular IP range specification.
* Calls to {@link IPMatcher#match(String) match} method will then quickly
* determine whether a given IP falls within that range.
* <p>
* Supported range specifications areL
* <p>
* <ul>
* <li>Full IP address, e.g. {@code 12.34.56.78}</li>
* <li>Partial IP address, e.g. {@code 12.34} (which matches any IP starting
* {@code 12.34})</li>
* <li>Network/netmask, e.g. {@code 18.25.0.0/255.255.0.0}</li>
* <li>CIDR slash notation, e.g. {@code 18.25.0.0/16}</li>
* </ul>
*
* @version $Revision$
* @author Robert Tansley
*/
public class IPMatcher
{
/** Network to match */
private byte[] network;
/** Network mask */
private byte[] netmask;
/**
* Construct an IPMatcher that will test for the given IP specification
*
* @param ipSpec
* IP specification (full or partial URL, network/netmask,
* network/cidr)
* @throws IPMatcherException
* if there is an error parsing the specification (i.e. it is
* somehow malformed)
*/
public IPMatcher(String ipSpec) throws IPMatcherException
{
// Boil all specs down to network + mask
network = new byte[4];
netmask = new byte[] { -1, -1, -1, -1 };
// Allow partial IP
boolean mustHave4 = false;
String ipPart = ipSpec;
String[] parts = ipSpec.split("/");
switch (parts.length)
{
case 2:
// Some kind of slash notation -- we'll need a full network IP
ipPart = parts[0];
mustHave4 = true;
String[] maskParts = parts[1].split("\\.");
if (maskParts.length == 1)
{
// CIDR slash notation
int x;
try
{
x = Integer.parseInt(maskParts[0]);
}
catch (NumberFormatException nfe)
{
throw new IPMatcherException(
"Malformed IP range specification " + ipSpec, nfe);
}
if (x < 0 || x > 32)
{
throw new IPMatcherException();
}
int fullMask = -1 << (32 - x);
netmask[0] = (byte) ((fullMask & 0xFF000000) >>> 24);
netmask[1] = (byte) ((fullMask & 0x00FF0000) >>> 16);
netmask[2] = (byte) ((fullMask & 0x0000FF00) >>> 8);
netmask[3] = (byte) (fullMask & 0x000000FF);
}
else
{
// full subnet specified
ipToBytes(parts[1], netmask, true);
}
case 1:
// Get IP
int partCount = ipToBytes(ipPart, network, mustHave4);
// If partial IP, set mask for remaining bytes
for (int i = 3; i >= partCount; i--)
{
netmask[i] = 0;
}
break;
default:
throw new IPMatcherException("Malformed IP range specification "
+ ipSpec);
}
}
/**
* Fill out a given four-byte array with the IP address specified in the
* given String
*
* @param ip
* IP address as a dot-delimited String
* @param bytes
* 4-byte array to fill out
* @param mustHave4
* if true, will require that the given IP string specify all
* four bytes
* @return the number of actual IP bytes found in the given IP address
* String
* @throws IPMatcherException
* if there is a problem parsing the IP string -- e.g. number
* outside of range 0-255, too many numbers, less than 4 numbers
* if {@code mustHave4} is true
*/
private int ipToBytes(String ip, byte[] bytes, boolean mustHave4)
throws IPMatcherException
{
String[] parts = ip.split("\\.");
if (parts.length > 4 || mustHave4 && parts.length != 4)
{
throw new IPMatcherException("Malformed IP specification " + ip);
}
try
{
for (int i = 0; i < parts.length; i++)
{
int p = Integer.parseInt(parts[i]);
if (p < 0 || p > 255)
{
throw new IPMatcherException("Malformed IP specification "
+ ip);
}
bytes[i] = (byte) (p < 128 ? p : p - 256);
}
}
catch (NumberFormatException nfe)
{
throw new IPMatcherException("Malformed IP specification " + ip,
nfe);
}
return parts.length;
}
/**
* Determine whether the given full IP falls within the range this
* {@code IPMatcher} was initialized with.
*
* @param ipIn
* IP address as dot-delimited String
* @return {@code true} if the IP matches the range of this
* {@code IPMatcher}; {@code false} otherwise
* @throws IPMatcherException
* if the IP passed in cannot be parsed correctly (i.e. is
* malformed)
*/
public boolean match(String ipIn) throws IPMatcherException
{
byte[] bytes = new byte[4];
ipToBytes(ipIn, bytes, true);
for (int i = 0; i < 4; i++)
{
if ((bytes[i] & netmask[i]) != (network[i] & netmask[i]))
{
return false;
}
}
return true;
}
}

View File

@@ -0,0 +1,69 @@
/*
* IPMatcherException.java
*
* Version: $Revision$
*
* Date: $Date$
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.authenticate;
/**
* Thrown when there is a problem parsing an IP matcher specification.
*
* @version $Revision$
* @author Robert Tansley
*/
public class IPMatcherException extends Exception
{
public IPMatcherException()
{
super();
}
public IPMatcherException(String message)
{
super(message);
}
public IPMatcherException(Throwable cause)
{
super(cause);
}
public IPMatcherException(String message, Throwable cause)
{
super(message, cause);
}
}

View File

@@ -37,32 +37,29 @@
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE. * DAMAGE.
*/ */
package org.dspace.eperson; package org.dspace.authenticate;
import java.io.IOException;
import java.sql.SQLException; import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.jstl.fmt.LocaleSupport;
import java.util.ArrayList;
import java.util.Hashtable; import java.util.Hashtable;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.directory.BasicAttribute;
import javax.naming.directory.BasicAttributes;
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
import javax.naming.directory.SearchResult;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.dspace.authorize.AuthorizeException;
import org.dspace.core.ConfigurationManager; import org.dspace.core.ConfigurationManager;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.core.LogManager; import org.dspace.core.LogManager;
import org.dspace.core.ConfigurationManager;
import org.dspace.eperson.EPerson; import org.dspace.eperson.EPerson;
import org.dspace.eperson.Group;
import org.dspace.eperson.AuthenticationMethod;
import org.dspace.eperson.AuthenticationManager;
import org.dspace.authorize.AuthorizeException;
import javax.naming.directory.*;
import javax.naming.*;
/** /**
* This is UNTESTED, since I do not have LDAP servers available. * This is UNTESTED, since I do not have LDAP servers available.
@@ -148,11 +145,15 @@ public class LDAPAuthentication
{ {
log.info(LogManager.getHeader(context, "auth", "attempting trivial auth of user="+netid)); log.info(LogManager.getHeader(context, "auth", "attempting trivial auth of user="+netid));
// Skip out when no netid or password is given.
if (netid == null || password == null)
return BAD_ARGS;
// Locate the eperson // Locate the eperson
EPerson eperson = null; EPerson eperson = null;
try try
{ {
eperson = EPerson.findByNetid(context, netid.toLowerCase()); eperson = EPerson.findByNetid(context, netid.toLowerCase());
} }
catch (SQLException e) catch (SQLException e)
{ {

View File

@@ -37,22 +37,19 @@
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE. * DAMAGE.
*/ */
package org.dspace.eperson; package org.dspace.authenticate;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.jstl.fmt.LocaleSupport;
import java.sql.SQLException;
import java.util.ArrayList;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.dspace.authorize.AuthorizeException;
import org.dspace.core.ConfigurationManager;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.core.LogManager; import org.dspace.core.LogManager;
import org.dspace.eperson.EPerson; import org.dspace.eperson.EPerson;
import org.dspace.eperson.AuthenticationMethod;
import org.dspace.authorize.AuthorizeException;
/** /**
* A stackable authentication method * A stackable authentication method
@@ -81,17 +78,45 @@ public class PasswordAuthentication
private static Logger log = Logger.getLogger(PasswordAuthentication.class); private static Logger log = Logger.getLogger(PasswordAuthentication.class);
/** /**
* Just return true since anyone can self-register by creating new * Look to see if this email address is allowed to register.
* EPerson. * <p>
* <p>NOTE: It may be desireable to have this consult a * The configuration key authentication.password.domain.valid is examined
* configuration parameter first. * in dspace.cfg to see what doamins are valid.
* <p>
* Example - aber.ac.uk domains : @aber.ac.uk
* Example - MIT domain and all .ac.uk domains: @mit.edu, .ac.uk
*/ */
public boolean canSelfRegister(Context context, public boolean canSelfRegister(Context context,
HttpServletRequest request, HttpServletRequest request,
String username) String email)
throws SQLException throws SQLException
{ {
return true; // Is there anything set in authentication.password.domain.valid?
String domains = ConfigurationManager.getProperty("authentication.password.domain.valid");
if ((domains == null) || (domains.trim().equals("")))
{
// No conditions set, so must be able to self register
return true;
}
else
{
// Itterate through all domains
String[] options = domains.trim().split(",");
String check;
email = email.trim().toLowerCase();
for (int i = 0; i < options.length; i++)
{
check = options[i].trim().toLowerCase();
if (email.endsWith(check))
{
// A match, so we can register this user
return true;
}
}
// No match
return false;
}
} }
/** /**

View File

@@ -37,43 +37,33 @@
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE. * DAMAGE.
*/ */
package org.dspace.eperson; package org.dspace.authenticate;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.jstl.fmt.LocaleSupport;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.security.InvalidKeyException; import java.security.GeneralSecurityException;
import java.security.NoSuchAlgorithmException; import java.security.KeyStore;
import java.security.NoSuchProviderException;
import java.security.Principal; import java.security.Principal;
import java.security.PublicKey; import java.security.PublicKey;
import java.security.cert.Certificate; import java.security.cert.Certificate;
import java.security.KeyStore;
import java.security.SignatureException;
import java.security.GeneralSecurityException;
import java.security.cert.CertificateException; import java.security.cert.CertificateException;
import java.security.cert.CertificateExpiredException;
import java.security.cert.CertificateFactory; import java.security.cert.CertificateFactory;
import java.security.cert.CertificateNotYetValidException;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;
import java.sql.SQLException;
import java.util.Enumeration;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.dspace.core.LogManager; import org.dspace.authorize.AuthorizeException;
import org.dspace.core.ConfigurationManager; import org.dspace.core.ConfigurationManager;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.core.LogManager;
import org.dspace.eperson.EPerson; import org.dspace.eperson.EPerson;
import org.dspace.eperson.AuthenticationMethod;
import org.dspace.authorize.AuthorizeException;
/** /**
* Implicit authentication method that gets credentials from the X.509 * Implicit authentication method that gets credentials from the X.509
@@ -120,6 +110,10 @@ public class X509Authentication
/** key store for CA certs if we use that */ /** key store for CA certs if we use that */
private static KeyStore caCertKeyStore = null; private static KeyStore caCertKeyStore = null;
private static String loginPageTitle = null;
private static String loginPageURL = null;
/** /**
* Initialization: * Initialization:
* Set caPublicKey and/or keystore. This loads the information * Set caPublicKey and/or keystore. This loads the information
@@ -127,6 +121,14 @@ public class X509Authentication
*/ */
static static
{ {
/*
* allow identification of alternative entry points
* for certificate authentication when
* selected by the user rather than implicitly.
*/
loginPageTitle = ConfigurationManager.getProperty("authentication.x509.chooser.title.key");
loginPageURL = ConfigurationManager.getProperty("authentication.x509.chooser.uri");
String keystorePath = ConfigurationManager.getProperty("authentication.x509.keystore.path"); String keystorePath = ConfigurationManager.getProperty("authentication.x509.keystore.path");
String keystorePassword = ConfigurationManager.getProperty("authentication.x509.keystore.password"); String keystorePassword = ConfigurationManager.getProperty("authentication.x509.keystore.password");
String caCertPath = ConfigurationManager.getProperty("authentication.x509.ca.cert"); String caCertPath = ConfigurationManager.getProperty("authentication.x509.ca.cert");
@@ -467,10 +469,10 @@ public class X509Authentication
} }
/** /**
* Return null, since this is an implicit method with no login page. * Returns URL of password-login servlet.
* *
* @param context * @param context
* DSpace context, will be modified (ePerson set) upon success. * DSpace context, will be modified (EPerson set) upon success.
* *
* @param request * @param request
* The HTTP request that started this operation, or null if not applicable. * The HTTP request that started this operation, or null if not applicable.
@@ -484,19 +486,20 @@ public class X509Authentication
HttpServletRequest request, HttpServletRequest request,
HttpServletResponse response) HttpServletResponse response)
{ {
return null; return loginPageURL;
} }
/** /**
* Return null, since this is an implicit method with no login page. * Returns message key for title of the "login" page, to use
* in a menu showing the choice of multiple login methods.
* *
* @param context * @param context
* DSpace context, will be modified (ePerson set) upon success. * DSpace context, will be modified (EPerson set) upon success.
* *
* @return Message key to look up in i18n message catalog. * @return Message key to look up in i18n message catalog.
*/ */
public String loginPageTitle(Context context) public String loginPageTitle(Context context)
{ {
return null; return loginPageTitle;
} }
} }

View File

@@ -0,0 +1,13 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
Author: Robert Tansley
Version: $Revision: 28 $
Date: $Date: 2002-05-21 16:32:38 -0400 (Tue, 21 May 2002) $
-->
</head>
<body bgcolor="white">
End-user authentication manager, interface and implementations.
</body>
</html>

View File

@@ -289,13 +289,8 @@ public class AuthorizeManager
} }
} }
List policies = getPoliciesActionFilter(c, o, action); for (ResourcePolicy rp : getPoliciesActionFilter(c, o, action))
Iterator i = policies.iterator();
while (i.hasNext())
{ {
ResourcePolicy rp = (ResourcePolicy) i.next();
// check policies for date validity // check policies for date validity
if (rp.isDateValid()) if (rp.isDateValid())
{ {
@@ -420,14 +415,14 @@ public class AuthorizeManager
* *
* @return List of <code>ResourcePolicy</code> objects * @return List of <code>ResourcePolicy</code> objects
*/ */
public static List getPolicies(Context c, DSpaceObject o) public static List<ResourcePolicy> getPolicies(Context c, DSpaceObject o)
throws SQLException throws SQLException
{ {
TableRowIterator tri = DatabaseManager.queryTable(c, "resourcepolicy", TableRowIterator tri = DatabaseManager.queryTable(c, "resourcepolicy",
"SELECT * FROM resourcepolicy WHERE resource_type_id= ? AND resource_id= ? ", "SELECT * FROM resourcepolicy WHERE resource_type_id= ? AND resource_id= ? ",
o.getType(),o.getID()); o.getType(),o.getID());
List policies = new ArrayList(); List<ResourcePolicy> policies = new ArrayList();
while (tri.hasNext()) while (tri.hasNext())
{ {
@@ -451,6 +446,45 @@ public class AuthorizeManager
return policies; return policies;
} }
/**
* Return a List of the policies for a group
*
* @param c current context
* @param g group to retrieve policies for
*
* @return List of <code>ResourcePolicy</code> objects
*/
public static List<ResourcePolicy> getPoliciesForGroup(Context c, Group g)
throws SQLException
{
TableRowIterator tri = DatabaseManager.queryTable(c, "resourcepolicy",
"SELECT * FROM resourcepolicy WHERE epersongroup_id= ? ",
g.getID());
List<ResourcePolicy> policies = new ArrayList<ResourcePolicy>();
while (tri.hasNext())
{
TableRow row = tri.next();
// first check the cache (FIXME: is this right?)
ResourcePolicy cachepolicy = (ResourcePolicy) c.fromCache(
ResourcePolicy.class, row.getIntColumn("policy_id"));
if (cachepolicy != null)
{
policies.add(cachepolicy);
}
else
{
policies.add(new ResourcePolicy(c, row));
}
}
tri.close();
return policies;
}
/** /**
* Return a list of policies for an object that match the action * Return a list of policies for an object that match the action
* *
@@ -463,7 +497,7 @@ public class AuthorizeManager
* @throws SQLException * @throws SQLException
* if there's a database problem * if there's a database problem
*/ */
public static List getPoliciesActionFilter(Context c, DSpaceObject o, public static List<ResourcePolicy> getPoliciesActionFilter(Context c, DSpaceObject o,
int actionID) throws SQLException int actionID) throws SQLException
{ {
TableRowIterator tri = DatabaseManager.queryTable(c, "resourcepolicy", TableRowIterator tri = DatabaseManager.queryTable(c, "resourcepolicy",
@@ -471,7 +505,7 @@ public class AuthorizeManager
"AND resource_id= ? AND action_id= ? ", "AND resource_id= ? AND action_id= ? ",
o.getType(), o.getID(),actionID); o.getType(), o.getID(),actionID);
List policies = new ArrayList(); List<ResourcePolicy> policies = new ArrayList<ResourcePolicy>();
while (tri.hasNext()) while (tri.hasNext())
{ {
@@ -512,7 +546,7 @@ public class AuthorizeManager
DSpaceObject dest) throws SQLException, AuthorizeException DSpaceObject dest) throws SQLException, AuthorizeException
{ {
// find all policies for the source object // find all policies for the source object
List policies = getPolicies(c, src); List<ResourcePolicy> policies = getPolicies(c, src);
addPolicies(c, policies, dest); addPolicies(c, policies, dest);
} }
@@ -531,16 +565,12 @@ public class AuthorizeManager
* @throws AuthorizeException * @throws AuthorizeException
* if the current user is not authorized to add these policies * if the current user is not authorized to add these policies
*/ */
public static void addPolicies(Context c, List policies, DSpaceObject dest) public static void addPolicies(Context c, List<ResourcePolicy> policies, DSpaceObject dest)
throws SQLException, AuthorizeException throws SQLException, AuthorizeException
{ {
Iterator i = policies.iterator();
// now add them to the destination object // now add them to the destination object
while (i.hasNext()) for (ResourcePolicy srp : policies)
{ {
ResourcePolicy srp = (ResourcePolicy) i.next();
ResourcePolicy drp = ResourcePolicy.create(c); ResourcePolicy drp = ResourcePolicy.create(c);
// copy over values // copy over values
@@ -668,7 +698,7 @@ public class AuthorizeManager
"SELECT * FROM resourcepolicy WHERE resource_type_id= ? "+ "SELECT * FROM resourcepolicy WHERE resource_type_id= ? "+
"AND resource_id= ? AND action_id= ? ",o.getType(),o.getID(),actionID); "AND resource_id= ? AND action_id= ? ",o.getType(),o.getID(),actionID);
List groups = new ArrayList(); List<Group> groups = new ArrayList<Group>();
while (tri.hasNext()) while (tri.hasNext())
{ {
@@ -700,7 +730,7 @@ public class AuthorizeManager
tri.close(); tri.close();
Group[] groupArray = new Group[groups.size()]; Group[] groupArray = new Group[groups.size()];
groupArray = (Group[]) groups.toArray(groupArray); groupArray = groups.toArray(groupArray);
return groupArray; return groupArray;
} }

View File

@@ -138,6 +138,7 @@ public class FixDefaultPolicies
} }
c.complete(); c.complete();
System.exit(0);
} }
/** /**

View File

@@ -41,6 +41,9 @@ package org.dspace.authorize;
import java.sql.SQLException; import java.sql.SQLException;
import org.dspace.authorize.AuthorizeException;
import org.dspace.authorize.AuthorizeManager;
import org.dspace.authorize.ResourcePolicy;
import org.dspace.content.Bitstream; import org.dspace.content.Bitstream;
import org.dspace.content.Bundle; import org.dspace.content.Bundle;
import org.dspace.content.Collection; import org.dspace.content.Collection;
@@ -67,7 +70,7 @@ public class PolicySet
if (argv.length < 6) if (argv.length < 6)
{ {
System.out System.out
.println("Args: containerType containerID contentType actionID groupID command"); .println("Args: containerType containerID contentType actionID groupID command [filter]");
System.out.println("container=COLLECTION command = ADD|REPLACE"); System.out.println("container=COLLECTION command = ADD|REPLACE");
return; return;
@@ -81,6 +84,11 @@ public class PolicySet
boolean isReplace = false; boolean isReplace = false;
String command = argv[5]; String command = argv[5];
String filter = null;
if ( argv.length == 7 )
{
filter = argv[6];
}
if (command.equals("REPLACE")) if (command.equals("REPLACE"))
{ {
@@ -95,12 +103,13 @@ public class PolicySet
////////////////////// //////////////////////
// carnage begins here // carnage begins here
////////////////////// //////////////////////
setPolicies(c, containertype, containerID, contenttype, actionID, setPoliciesFilter(c, containertype, containerID, contenttype, actionID,
groupID, isReplace, false); groupID, isReplace, false, filter);
c.complete(); c.complete();
System.exit(0);
} }
/** /**
* Useful policy wildcard tool. Can set entire collections' contents' * Useful policy wildcard tool. Can set entire collections' contents'
* policies * policies
@@ -132,6 +141,44 @@ public class PolicySet
int containerID, int contentType, int actionID, int groupID, int containerID, int contentType, int actionID, int groupID,
boolean isReplace, boolean clearOnly) throws SQLException, boolean isReplace, boolean clearOnly) throws SQLException,
AuthorizeException AuthorizeException
{
setPoliciesFilter(c, containerType, containerID, contentType,
actionID, groupID, isReplace, clearOnly, null);
}
/**
* Useful policy wildcard tool. Can set entire collections' contents'
* policies
*
* @param c
* current context
* @param containerType
* type, Constants.ITEM or Constants.COLLECTION
* @param containerID
* ID of container (DB primary key)
* @param contentType
* type (BUNDLE, ITEM, or BITSTREAM)
* @param actionID
* action ID
* @param groupID
* group ID (database key)
* @param isReplace
* if <code>true</code>, existing policies are removed first,
* otherwise add to existing policies
* @param clearOnly
* if <code>true</code>, just delete policies for matching
* objects
* @param filter
* if non-null, only process bitstreams whose names contain filter
* @throws SQLException
* if database problem
* @throws AuthorizeException
* if current user is not authorized to change these policies
*/
public static void setPoliciesFilter(Context c, int containerType,
int containerID, int contentType, int actionID, int groupID,
boolean isReplace, boolean clearOnly, String filter) throws SQLException,
AuthorizeException
{ {
if (containerType == Constants.COLLECTION) if (containerType == Constants.COLLECTION)
{ {
@@ -221,22 +268,26 @@ public class PolicySet
{ {
Bitstream t = bitstreams[k]; // t for target Bitstream t = bitstreams[k]; // t for target
// is this a replace? delete policies first if ( filter == null ||
if (isReplace || clearOnly) t.getName().indexOf( filter ) != -1 )
{ {
AuthorizeManager.removeAllPolicies(c, t); // is this a replace? delete policies first
} if (isReplace || clearOnly)
{
AuthorizeManager.removeAllPolicies(c, t);
}
if (!clearOnly) if (!clearOnly)
{ {
// now add the policy // now add the policy
ResourcePolicy rp = ResourcePolicy.create(c); ResourcePolicy rp = ResourcePolicy.create(c);
rp.setResource(t); rp.setResource(t);
rp.setAction(actionID); rp.setAction(actionID);
rp.setGroup(group); rp.setGroup(group);
rp.update(); rp.update();
}
} }
} }
} }

View File

@@ -350,7 +350,7 @@ public class ResourcePolicy
if (ed != null) if (ed != null)
{ {
// end date is set, return false if we're after it // end date is set, return false if we're after it
if (now.after(sd)) if (now.after(ed))
{ {
return false; return false;
} }

View File

@@ -0,0 +1,168 @@
/*
* BrowseConsumer.java
*
* Version: $Revision: 1.4 $
*
* Date: $Date: 2006/04/10 04:11:09 $
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
import java.util.HashSet;
import java.util.Set;
import org.apache.log4j.Logger;
import org.dspace.content.DSpaceObject;
import org.dspace.content.Item;
import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.dspace.event.Consumer;
import org.dspace.event.Event;
/**
* Class for updating browse system from content events.
* Prototype: only Item events recognized.
*
* XXX FIXME NOTE: The Browse Consumer is INCOMPLETE because the
* deletion of an Item CANNOT be implemented as an event consumer:
* When an Item is deleted, the browse tables must be updated
* immediately, within the same transaction, to maintain referential
* consistency. It cannot be handled in an Event consumer since by
* definition that runs after the transaction is committed.
* Perhaps this can be addressed if the Browse system is replaced.
*
* To handle create/modify events: accumulate Sets of Items to be added
* and updated out of the event stream. Process them in endEvents()
* filter out update requests for Items that were just created.
*
* Recommended filter: Item+Create|Modify|Modify_Metadata:Collection+Add|Remove
*
* @version $Revision: 1.1 $
*/
public class BrowseConsumer implements Consumer
{
/** log4j logger */
private static Logger log = Logger.getLogger(BrowseConsumer.class);
// items to be updated in browse index
private Set<Item> toUpdate = null;
public void initialize()
throws Exception
{
}
public void consume(Context ctx, Event event)
throws Exception
{
if(toUpdate == null)
{
toUpdate = new HashSet<Item>();
}
DSpaceObject subj = event.getSubject(ctx);
int st = event.getSubjectType();
int et = event.getEventType();
switch (st)
{
// If an Item is created or modified..
case Constants.ITEM:
toUpdate.add((Item)subj);
break;
// track ADD and REMOVE from collections, that changes browse index.
case Constants.COLLECTION:
if (event.getObjectType() == Constants.ITEM
&& (et == Event.ADD || et == Event.REMOVE))
{
Item obj = (Item)event.getObject(ctx);
if (obj != null)
toUpdate.add(obj);
}
break;
default:
log.warn("consume() got unrecognized event: " + event.toString());
}
}
public void end(Context ctx)
throws Exception
{
if (toUpdate != null)
{
// Update/Add items
for (Item i : toUpdate)
{
// FIXME: there is an exception handling problem here
try
{
// Update browse indices
IndexBrowse ib = new IndexBrowse(ctx);
ib.indexItem(i);
}
catch (BrowseException e)
{
log.error("caught exception: ", e);
//throw new SQLException(e.getMessage());
}
if (log.isDebugEnabled())
log.debug("Updated browse indices for Item id="
+ String.valueOf(i.getID()) + ", hdl="
+ i.getHandle());
}
// NOTE: Removed items are necessarily handled inline (ugh).
// browse updates wrote to the DB, so we have to commit.
ctx.getDBConnection().commit();
}
// clean out toUpdate
toUpdate = null;
}
public void finish(Context ctx) {
}
}

View File

@@ -0,0 +1,390 @@
/*
* BrowseCreateDAO.java
*
* Version: $Revision: $
*
* Date: $Date: $
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
import java.util.List;
import java.util.Map;
/**
* Interface for any class wishing to provide a browse storage later. This particular
* Data Access Object deals with building and destroying the database, and inserting and
* removing content from it. There is an alternative class BrowseDAO which deals with
* Read-Only operations.
*
* If you implement this class, and you wish it to be loaded via the BrowseDAOFactory
* you must supply a constructor of the form:
*
* public BrowseCreateDAOImpl(Context context) {}
*
* Where Context is the DSpace Context object
*
* Where tables are referred to in this class, they can be obtained from the BrowseIndex
* class, which will answer queries given the context of the request on which table
* is the relevant target.
*
* @author Richard Jones
*
*/
public interface BrowseCreateDAO
{
// this must have a constructor which takes a DSpace Context as
// an argument, thus:
//
// public BrowseCreateDAO(Context context)
/**
* Delete the record for the given item id from the specified table.
*
* Table names can be obtained from the BrowseIndex class
*
* @param table the browse table to remove the index from
* @param itemID the database id of the item to remove the index for
* @throws BrowseException
*/
public void deleteByItemID(String table, int itemID) throws BrowseException;
public void deleteCommunityMappings(int itemID) throws BrowseException;
public void updateCommunityMappings(int itemID) throws BrowseException;
/**
* Insert an index record into the given table for the given item id. The Map should contain
* key value pairs representing the sort column integer representation and the normalised
* value for that field.
*
* For example, the caller might do as follows:
*
* <code>
* Map map = new HashMap();
* map.put(new Integer(1), "the title");
* map.put(new Integer(2), "the subject");
*
* BrowseCreateDAO dao = BrowseDAOFactory.getCreateInstance();
* dao.insertIndex("index_1", 21, map);
* </code>
*
* @param table the browse table to insert the index in
* @param itemID the database id of the item being indexed
* @param sortCols an Integer-String map of sort column numbers and values
* @throws BrowseException
*/
public void insertIndex(String table, int itemID, Map sortCols) throws BrowseException;
/**
* Updates an index record into the given table for the given item id. The Map should contain
* key value pairs representing the sort column integer representation and the normalised
* value for that field.
*
* For example, the caller might do as follows:
*
* <code>
* Map map = new HashMap();
* map.put(new Integer(1), "the title");
* map.put(new Integer(2), "the subject");
*
* BrowseCreateDAO dao = BrowseDAOFactory.getCreateInstance();
* dao.updateIndex("index_1", 21, map);
* </code>
*
* @param table the browse table to insert the index in
* @param itemID the database id of the item being indexed
* @param sortCols an Integer-String map of sort column numbers and values
* @return true if the record is updated, false if not found
* @throws BrowseException
*/
public boolean updateIndex(String table, int itemID, Map sortCols) throws BrowseException;
/**
* Get the browse index's internal id for the location of the given string
* and sort value in the given table. This method should always return a
* positive integer, as if no existing ID is available for the given value
* then one should be inserted using the data supplied, and the ID returned.
*
* Generally this method is used in conjunction with createDistinctMapping thus:
*
* <code>
* BrowseCreateDAO dao = BrowseDAOFactory.getCreateInstance();
* dao.createDistinctMapping("index_1_distinct_map", 21,
* dao.getDistinctID("index_1_distinct", "Human Readable", "human readable"));
* </code>
*
* When it creates a distinct record, it would usually do so through insertDistinctRecord
* defined below.
*
* @param table the table in which to look for/create the id
* @param value the value on which to search
* @param sortValue the sort value to use in case of the need to create
* @return the database id of the distinct record
* @throws BrowseException
*/
public int getDistinctID(String table, String value, String sortValue) throws BrowseException;
/**
* Insert the given value and sort value into the distinct index table. This
* returns an integer which represents the database id of the created record, so
* that it can be used, for example in createDistinctMapping thus:
*
* <code>
* BrowseCreateDAO dao = BrowseDAOFactory.getCreateInstance();
* dao.createDistinctMapping("index_1_distinct_map", 21,
* dao.insertDistinctRecord("index_1_distinct", "Human Readable", "human readable"));
* </code>
*
* This is less good than using getDistinctID defined above, as if there is
* already a distinct value in the table it may throw an exception
*
* @param table the table into which to insert the record
* @param value the value to insert
* @param sortValue the sort value to insert
* @return the database id of the created record
* @throws BrowseException
*/
public int insertDistinctRecord(String table, String value, String sortValue) throws BrowseException;
/**
* Update a mapping between an item id and a distinct metadata field such as an author,
* who can appear in multiple items. To get the id of the distinct record you should
* use either getDistinctID or insertDistinctRecord as defined above.
*
* @param table the mapping table
* @param itemID the item id
* @param distinctIDs the id of the distinct record
* @throws BrowseException
*/
public boolean updateDistinctMappings(String table, int itemID, int[] distinctIDs) throws BrowseException;
/**
* Find out of a given table exists.
*
* @param table the table to test
* @return true if exists, false if not
* @throws BrowseException
*/
public boolean testTableExistance(String table) throws BrowseException;
/**
* Drop the given table name, and all other resources that are attached to it. In normal
* relational database land this will include constraints and views. If the boolean execute
* is true this operation should be carried out, and if it is false it should not. The returned
* string should contain the SQL (if relevant) that the caller can do with what they like
* (for example, output to the screen).
*
* @param table The table to drop
* @param execute Whether to action the removal or not
* @return The instructions (SQL) that effect the removal
* @throws BrowseException
*/
public String dropIndexAndRelated(String table, boolean execute) throws BrowseException;
/**
* Drop the given sequence name. This is relevant to most forms of database, but not all.
* If the boolean execute is true this operation should be carried out, and if it is false
* it should not. The returned string should contain the SQL (if relevant) that the caller
* can do with what they like (for example, output to the screen)
*
* @param sequence the sequence to drop
* @param execute whether to action the removal or not
* @return The instructions (SQL) that effect the removal
* @throws BrowseException
*/
public String dropSequence(String sequence, boolean execute) throws BrowseException;
/**
* Drop the given view name. This is relevant to most forms of database, but not all.
* If the boolean execute is true this operation should be carried out, and if it is false
* it should not. The returned string should contain the SQL (if relevant) that the caller
* can do with what they like (for example, output to the screen)
*
* @param view the view to drop
* @param execute whether to action the removal or not
* @return The instructions (SQL) that effect the removal
* @throws BrowseException
*/
public String dropView(String view, boolean execute) throws BrowseException;
/**
* Create the sequence with the given name. This is relevant to most forms of database, but not all.
* If the boolean execute is true this operation should be carried out, and if it is false
* it should not. The returned string should contain the SQL (if relevant) that the caller
* can do with what they like (for example, output to the screen)
*
* @param sequence the sequence to create
* @param execute whether to action the create or not
* @return the instructions (SQL) that effect the creation
* @throws BrowseException
*/
public String createSequence(String sequence, boolean execute) throws BrowseException;
/**
* Create the main index table. This is the one which will contain a single row per
* item. If the boolean execute is true this operation should be carried out, and if it is false
* it should not. The returned string should contain the SQL (if relevant) that the caller
* can do with what they like (for example, output to the screen)
*
* This form is used for the primary item browse tables
*
* This should be used, for example, like this:
*
* <code>
* List list = new ArrayList();
* list.add(new Integer(1));
* list.add(new Integer(2));
*
* BrowseCreateDAO dao = BrowseDAOFactory.getCreateInstance();
* dao.createPrimaryTable("index_1", list, true);
* </code>
*
* @param table the raw table to create
* @param sortCols a List of Integers numbering the sort columns required
* @param execute whether to action the create or not
* @return the instructions (SQL) that effect the creation
* @throws BrowseException
*/
public String createPrimaryTable(String table, List sortCols, boolean execute) throws BrowseException;
/**
* Create any indices that the implementing DAO sees fit to maximise performance.
* If the boolean execute is true this operation should be carried out, and if it is false
* it should not. The returned string array should contain the SQL (if relevant) that the caller
* can do with what they like (for example, output to the screen). It's an array so that
* you can return each bit of SQL as an element if you want.
*
* @param table the table upon which to create indices
* @param sortCols TODO
* @param execute whether to action the create or not
* @return the instructions (SQL) that effect the indices
* @throws BrowseException
*/
public String[] createDatabaseIndices(String table, List<Integer> sortCols, boolean value, boolean execute) throws BrowseException;
/**
* Create any indices that the implementing DAO sees fit to maximise performance.
* If the boolean execute is true this operation should be carried out, and if it is false
* it should not. The returned string array should contain the SQL (if relevant) that the caller
* can do with what they like (for example, output to the screen). It's an array so that
* you can return each bit of SQL as an element if you want.
*
* @param disTable the distinct table upon which to create indices
* @param mapTable the mapping table upon which to create indices
* @param execute whether to action the create or not
* @return the instructions (SQL) that effect the indices
* @throws BrowseException
*/
public String[] createMapIndices(String disTable, String mapTable, boolean execute) throws BrowseException;
/**
* Create the View of the full item index as seen from a collection.
* If the boolean execute is true this operation should be carried out, and if it is false
* it should not. The returned string array should contain the SQL (if relevant) that the caller
* can do with what they like (for example, output to the screen).
*
* @param table the table to create the view on
* @param view the name of the view to create
* @param execute whether to action the create or not
* @return the instructions (SQL) that effects the create
* @throws BrowseException
*/
public String createCollectionView(String table, String view, boolean execute) throws BrowseException;
/**
* Create the View of the full item index as seen from a community
* If the boolean execute is true this operation should be carried out, and if it is false
* it should not. The returned string array should contain the SQL (if relevant) that the caller
* can do with what they like (for example, output to the screen).
*
* @param table the table to create the view on
* @param view the name of the view to create
* @param execute whether to action the create or not
* @return the instructions (SQL) that effects the create
* @throws BrowseException
*/
public String createCommunityView(String table, String view, boolean execute) throws BrowseException;
/**
* Create the table which will hold the distinct metadata values that appear in multiple
* items. For example, this table may hold a list of unique authors, each name in the
* metadata for the entire system appearing only once. Or for subject classifications.
* If the boolean execute is true this operation should be carried out, and if it is false
* it should not. The returned string array should contain the SQL (if relevant) that the caller
* can do with what they like (for example, output to the screen).
*
* @param table the table to create
* @param execute whether to action the create or not
* @return the instructions (SQL) that effects the create
* @throws BrowseException
*/
public String createDistinctTable(String table, boolean execute) throws BrowseException;
/**
* Create a table to hold a mapping between an item and a distinct metadata value that can appear
* across multiple items (for example, author names). If the boolean execute is true this
* operation should be carried out, and if it is false it should not.
*
* @param table the name of the distinct table which holds the target of the mapping
* @param map the name of the mapping table itself
* @param execute whether to execute the query or not
* @return
* @throws BrowseException
*/
public String createDistinctMap(String table, String map, boolean execute) throws BrowseException;
/**
* So that any left over indices for items which have been deleted can be assured to have
* been removed, this method checks for indicies for items which are not in the item table.
* If it finds an index which does not have an associated item it removes it.
*
* @param table the index table to check
* @param map the name of the associated distinct mapping table
* @param withdrawn TODO
* @throws BrowseException
*/
public void pruneExcess(String table, String map, boolean withdrawn) throws BrowseException;
/**
* So that there are no distinct values indexed which are no longer referenced from the
* map table, this method checks for values which are not referenced from the map,
* and removes them.
*
* @param table the name of the distinct index table
* @param map the name of the associated distinct mapping table.
* @throws BrowseException
*/
public void pruneDistinct(String table, String map) throws BrowseException;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,957 @@
/*
* BrowseCreateDAOPostgres.java
*
* Version: $Revision: $
*
* Date: $Date: $
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.dspace.core.Context;
import org.dspace.storage.rdbms.DatabaseManager;
import org.dspace.storage.rdbms.TableRow;
import org.dspace.storage.rdbms.TableRowIterator;
/**
* This class implements the BrowseCreateDAO interface for the PostgreSQL database
* as associated with the default DSpace installation. This class should not
* be instantiated directly, but should be obtained via the BrowseDAOFactory:
*
* <code>
* Context context = new Context();
* BrowseCreateDAO dao = BrowseDAOFactory.getCreateInstance(context);
* </code>
*
* This class will then be loaded if the appropriate configuration is made.
*
* @author Richard Jones
* @author Graham Triggs
*/
public class BrowseCreateDAOPostgres implements BrowseCreateDAO
{
/** Log4j logger */
private static Logger log = Logger.getLogger(BrowseCreateDAOPostgres.class);
/** internal copy of the current DSpace context (including the database connection) */
private Context context;
/** Database specific set of utils used when prepping the database */
private BrowseDAOUtils utils;
/**
* Required constructor for classes implementing the BrowseCreateDAO interface.
* Takes a DSpace context to use to connect to the database with.
*
* @param context the DSpace context
*/
public BrowseCreateDAOPostgres(Context context)
throws BrowseException
{
this.context = context;
// obtain the relevant Utils for this class
utils = BrowseDAOFactory.getUtils(context);
}
/* (non-Javadoc)
* @see org.dspace.browse.BrowseCreateDAO#createCollectionView(java.lang.String, java.lang.String, boolean)
*/
public String createCollectionView(String table, String view, boolean execute)
throws BrowseException
{
try
{
String createColView = "CREATE VIEW " + view + " as " +
"SELECT Collection2Item.collection_id, " + table + ".* " +
"FROM " + table + ", Collection2Item " +
"WHERE " + table + ".item_id = Collection2Item.item_id;";
if (execute)
{
DatabaseManager.updateQuery(context, createColView);
}
return createColView;
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new BrowseException(e);
}
}
/* (non-Javadoc)
* @see org.dspace.browse.BrowseCreateDAO#createCommunityView(java.lang.String, java.lang.String, boolean)
*/
public String createCommunityView(String table, String view, boolean execute)
throws BrowseException
{
try
{
String createComView = "CREATE VIEW " + view + " as " +
"SELECT Communities2Item.community_id, " + table + ".* " +
"FROM " + table + ", Communities2Item " +
"WHERE " + table + ".item_id = Communities2Item.item_id;";
if (execute)
{
DatabaseManager.updateQuery(context, createComView);
}
return createComView;
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new BrowseException(e);
}
}
/* (non-Javadoc)
* @see org.dspace.browse.BrowseCreateDAO#createDatabaseIndices(java.lang.String, boolean)
*/
public String[] createDatabaseIndices(String table, List<Integer> sortCols, boolean value, boolean execute)
throws BrowseException
{
try
{
ArrayList<String> array = new ArrayList<String>();
array.add("CREATE INDEX " + table + "_item_id_idx ON " + table + "(item_id);");
if (value)
array.add("CREATE INDEX " + table + "_value_idx ON " + table + "(sort_value);");
for (Integer i : sortCols)
{
array.add("CREATE INDEX " + table + "_s" + i + "_idx ON " + table + "(sort_" + i + ");");
}
if (execute)
{
for (String query : array)
{
DatabaseManager.updateQuery(context, query);
}
}
String[] arr = new String[array.size()];
return array.toArray(arr);
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new BrowseException(e);
}
}
/* (non-Javadoc)
* @see org.dspace.browse.BrowseCreateDAO#createDatabaseIndices(java.lang.String, boolean)
*/
public String[] createMapIndices(String disTable, String mapTable, boolean execute) throws BrowseException
{
try
{
String[] arr = new String[3];
arr[0] = "CREATE INDEX " + disTable + "_value_idx ON " + disTable + "(sort_value);";
arr[1] = "CREATE INDEX " + mapTable + "_item_id_idx ON " + mapTable + "(item_id);";
arr[2] = "CREATE INDEX " + mapTable + "_dist_idx ON " + mapTable + "(distinct_id);";
if (execute)
{
for (String query : arr)
{
DatabaseManager.updateQuery(context, query);
}
}
return arr;
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new BrowseException(e);
}
}
/* (non-Javadoc)
* @see org.dspace.browse.BrowseCreateDAO#createDistinctMap(java.lang.String, java.lang.String, boolean)
*/
public String createDistinctMap(String table, String map, boolean execute)
throws BrowseException
{
try
{
String create = "CREATE TABLE " + map + " (" +
"map_id integer primary key, " +
"item_id integer references item(item_id), " +
"distinct_id integer references " + table + "(id)" +
");";
if (execute)
{
DatabaseManager.updateQuery(context, create);
}
return create;
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new BrowseException(e);
}
}
/* (non-Javadoc)
* @see org.dspace.browse.BrowseCreateDAO#updateDistinctMapping(java.lang.String, int, int)
*/
public boolean updateDistinctMappings(String table, int itemID, int[] distinctIDs) throws BrowseException
{
try
{
// Remove (set to -1) any duplicate distinctIDs
for (int i = 0; i < distinctIDs.length; i++)
{
if (!isFirstOccurrence(distinctIDs, i))
distinctIDs[i] = -1;
}
// Find all existing mappings for this item
TableRowIterator tri = DatabaseManager.queryTable(context, table, "SELECT * FROM " + table + " WHERE item_id=?", itemID);
if (tri != null)
{
while (tri.hasNext())
{
TableRow tr = tri.next();
// Check the item mappings to see if it contains this mapping
boolean itemIsMapped = false;
int trDistinctID = tr.getIntColumn("distinct_id");
for (int i = 0; i < distinctIDs.length; i++)
{
// Found this mapping
if (distinctIDs[i] == trDistinctID)
{
// Flag it, and remove (-1) from the item mappings
itemIsMapped = true;
distinctIDs[i] = -1;
}
}
// The item is no longer mapped to this community, so remove the database record
if (!itemIsMapped)
DatabaseManager.delete(context, tr);
}
}
// Any remaining mappings need to be added to the database
for (int i = 0; i < distinctIDs.length; i++)
{
if (distinctIDs[i] > -1)
{
TableRow row = DatabaseManager.create(context, table);
row.setColumn("item_id", itemID);
row.setColumn("distinct_id", distinctIDs[i]);
DatabaseManager.update(context, row);
}
}
}
catch (SQLException e)
{
log.error("caught exception: ", e);
String msg = "problem updating distinct mappings: table=" + table + ",item-id=" + itemID;
throw new BrowseException(msg, e);
}
return false;
}
/* (non-Javadoc)
* @see org.dspace.browse.BrowseCreateDAO#createDistinctTable(java.lang.String, boolean)
*/
public String createDistinctTable(String table, boolean execute)
throws BrowseException
{
try
{
String create = "CREATE TABLE " + table + " (" +
"id integer primary key, " +
"value " + getValueColumnDefinition() + ", " +
"sort_value " + getSortColumnDefinition() +
");";
if (execute)
{
DatabaseManager.updateQuery(context, create);
}
return create;
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new BrowseException(e);
}
}
/* (non-Javadoc)
* @see org.dspace.browse.BrowseCreateDAO#createPrimaryTable(java.lang.String, java.util.List, boolean)
*/
public String createPrimaryTable(String table, List sortCols, boolean execute)
throws BrowseException
{
try
{
StringBuffer sb = new StringBuffer();
Iterator itr = sortCols.iterator();
while (itr.hasNext())
{
Integer no = (Integer) itr.next();
sb.append(", sort_");
sb.append(no.toString());
sb.append(getSortColumnDefinition());
}
String createTable = "CREATE TABLE " + table + " (" +
"id integer primary key," +
"item_id integer references item(item_id)" +
sb.toString() +
");";
if (execute)
{
DatabaseManager.updateQuery(context, createTable);
}
return createTable;
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new BrowseException(e);
}
}
/* (non-Javadoc)
* @see org.dspace.browse.BrowseCreateDAO#createSequence(java.lang.String, boolean)
*/
public String createSequence(String sequence, boolean execute)
throws BrowseException
{
try
{
String create = "CREATE SEQUENCE " + sequence + ";";
if (execute)
{
DatabaseManager.updateQuery(context, create);
}
return create;
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new BrowseException(e);
}
}
/* (non-Javadoc)
* @see org.dspace.browse.BrowseCreateDAO#deleteByItemID(java.lang.String, int)
*/
public void deleteByItemID(String table, int itemID)
throws BrowseException
{
try
{
Object[] params = { new Integer(itemID) };
String dquery = "DELETE FROM " + table + " WHERE item_id = ?";
DatabaseManager.updateQuery(context, dquery, params);
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new BrowseException(e);
}
}
/* (non-Javadoc)
* @see org.dspace.browse.BrowseCreateDAO#deleteCommunityMappings(java.lang.String, int)
*/
public void deleteCommunityMappings(int itemID)
throws BrowseException
{
try
{
Object[] params = { new Integer(itemID) };
String dquery = "DELETE FROM Communities2Item WHERE item_id = ?";
DatabaseManager.updateQuery(context, dquery, params);
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new BrowseException(e);
}
}
/* (non-Javadoc)
* @see org.dspace.browse.BrowseCreateDAO#dropIndexAndRelated(java.lang.String, boolean)
*/
public String dropIndexAndRelated(String table, boolean execute)
throws BrowseException
{
try
{
String dropper = "DROP TABLE " + table + " CASCADE;";
if (execute)
{
DatabaseManager.updateQuery(context, dropper);
}
return dropper;
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new BrowseException(e);
}
}
/* (non-Javadoc)
* @see org.dspace.browse.BrowseCreateDAO#dropSequence(java.lang.String, boolean)
*/
public String dropSequence(String sequence, boolean execute)
throws BrowseException
{
try
{
String dropSeq = "DROP SEQUENCE " + sequence + ";";
if (execute)
{
DatabaseManager.updateQuery(context, dropSeq);
}
return dropSeq;
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new BrowseException(e);
}
}
/* (non-Javadoc)
* @see org.dspace.browse.BrowseCreateDAO#dropView(java.lang.String, boolean)
*/
public String dropView(String view, boolean execute)
throws BrowseException
{
/* Postgres VIEWs are dropped along with the main index
if (view != null && !"".equals(view))
{
try
{
String dropView = "DROP VIEW " + view + " CASCADE;";
if (execute)
{
DatabaseManager.updateQuery(context, dropView);
}
return dropView;
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new BrowseException(e);
}
}
*/
return "";
}
/* (non-Javadoc)
* @see org.dspace.browse.BrowseCreateDAO#getDistinctID(java.lang.String, java.lang.String, java.lang.String)
*/
public int getDistinctID(String table, String value, String sortValue)
throws BrowseException
{
TableRowIterator tri = null;
if (log.isDebugEnabled())
{
log.debug("getDistinctID: table=" + table + ",value=" + value + ",sortValue=" + sortValue);
}
try
{
Object[] params = { value };
String select = "SELECT id FROM " + table + " WHERE value = ?";
tri = DatabaseManager.query(context, select, params);
int distinctID = -1;
if (!tri.hasNext())
{
distinctID = insertDistinctRecord(table, value, sortValue);
}
else
{
distinctID = tri.next().getIntColumn("id");
}
if (log.isDebugEnabled())
{
log.debug("getDistinctID: return=" + distinctID);
}
return distinctID;
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new BrowseException(e);
}
finally
{
if (tri != null)
{
tri.close();
}
}
}
/* (non-Javadoc)
* @see org.dspace.browse.BrowseCreateDAO#updateCommunityMappings(int)
*/
public void updateCommunityMappings(int itemID) throws BrowseException
{
try
{
// Get all the communities for this item
int[] commID = getAllCommunityIDs(itemID);
// Remove (set to -1) any duplicate communities
for (int i = 0; i < commID.length; i++)
{
if (!isFirstOccurrence(commID, i))
commID[i] = -1;
}
// Find all existing mappings for this item
TableRowIterator tri = DatabaseManager.queryTable(context, "Communities2Item", "SELECT * FROM Communities2Item WHERE item_id=?", itemID);
if (tri != null)
{
while (tri.hasNext())
{
TableRow tr = tri.next();
// Check the item mappings to see if it contains this community mapping
boolean itemIsMapped = false;
int trCommID = tr.getIntColumn("community_id");
for (int i = 0; i < commID.length; i++)
{
// Found this community
if (commID[i] == trCommID)
{
// Flag it, and remove (-1) from the item mappings
itemIsMapped = true;
commID[i] = -1;
}
}
// The item is no longer mapped to this community, so remove the database record
if (!itemIsMapped)
DatabaseManager.delete(context, tr);
}
}
// Any remaining mappings need to be added to the database
for (int i = 0; i < commID.length; i++)
{
if (commID[i] > -1)
{
TableRow row = DatabaseManager.create(context, "Communities2Item");
row.setColumn("item_id", itemID);
row.setColumn("community_id", commID[i]);
DatabaseManager.update(context, row);
}
}
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new BrowseException(e);
}
}
/* (non-Javadoc)
* @see org.dspace.browse.BrowseCreateDAO#insertDistinctRecord(java.lang.String, java.lang.String, java.lang.String)
*/
public int insertDistinctRecord(String table, String value, String sortValue)
throws BrowseException
{
log.debug("insertDistinctRecord: table=" + table + ",value=" + value+ ",sortValue=" + sortValue);
try
{
TableRow dr = DatabaseManager.create(context, table);
dr.setColumn("value", utils.truncateValue(value));
dr.setColumn("sort_value", utils.truncateSortValue(sortValue));
DatabaseManager.update(context, dr);
int distinctID = dr.getIntColumn("id");
log.debug("insertDistinctRecord: return=" + distinctID);
return distinctID;
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new BrowseException(e);
}
}
/* (non-Javadoc)
* @see org.dspace.browse.BrowseCreateDAO#insertIndex(java.lang.String, int, java.lang.String, java.lang.String, java.util.Map)
*/
public void insertIndex(String table, int itemID, Map sortCols)
throws BrowseException
{
try
{
// create us a row in the index
TableRow row = DatabaseManager.create(context, table);
// set the primary information for the index
row.setColumn("item_id", itemID);
// now set the columns for the other sort values
Iterator itra = sortCols.keySet().iterator();
while (itra.hasNext())
{
Integer key = (Integer) itra.next();
String nValue = (String) sortCols.get(key);
row.setColumn("sort_" + key.toString(), utils.truncateSortValue(nValue));
}
DatabaseManager.update(context, row);
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new BrowseException(e);
}
}
/* (non-Javadoc)
* @see org.dspace.browse.BrowseCreateDAO#updateIndex(java.lang.String, int, java.util.Map)
*/
public boolean updateIndex(String table, int itemID, Map sortCols)
throws BrowseException
{
try
{
boolean rowUpdated = false;
TableRow row = DatabaseManager.findByUnique(context, table, "item_id", itemID);
// If the item does not exist in the table, return that it couldn't be found
if (row == null)
return false;
// Iterate through all the sort values
Iterator itra = sortCols.keySet().iterator();
while (itra.hasNext())
{
Integer key = (Integer) itra.next();
// Generate the appropriate column name
String column = "sort_" + key.toString();
// Create the value that will be written in to the column
String newValue = utils.truncateSortValue( (String) sortCols.get(key) );
// Check the column exists - if it doesn't, something has gone seriously wrong
if (!row.hasColumn(column))
throw new BrowseException("Column '" + column + "' does not exist in table " + table);
// Get the existing value from the column
String oldValue = row.getStringColumn(column);
// If the new value differs from the old value, update the column and flag that the row has changed
if (oldValue != null && !oldValue.equals(newValue))
{
row.setColumn(column, newValue);
rowUpdated = true;
}
else if (newValue != null && !newValue.equals(oldValue))
{
row.setColumn(column, newValue);
rowUpdated = true;
}
}
// We've updated the row, so save it back to the database
if (rowUpdated)
DatabaseManager.update(context, row);
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new BrowseException(e);
}
// Return that the original record was found
return true;
}
/* (non-Javadoc)
* @see org.dspace.browse.BrowseCreateDAO#pruneDistinct(java.lang.String, java.lang.String)
*/
public void pruneDistinct(String table, String map)
throws BrowseException
{
try
{
String query = "DELETE FROM " + table +
" WHERE id IN (SELECT id FROM " + table +
" EXCEPT SELECT distinct_id AS id FROM " + map + ")";
DatabaseManager.updateQuery(context, query);
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new BrowseException(e);
}
}
/* (non-Javadoc)
* @see org.dspace.browse.BrowseCreateDAO#pruneExcess(java.lang.String, java.lang.String)
*/
public void pruneExcess(String table, String map, boolean withdrawn)
throws BrowseException
{
try
{
String itemQuery = "SELECT item_id FROM item WHERE ";
if (withdrawn)
itemQuery += "withdrawn = true";
else
itemQuery += "in_archive = true AND withdrawn = false";
String delete = "DELETE FROM " + table + " WHERE item_id IN ( SELECT item_id FROM " + table + " EXCEPT " + itemQuery + ")";
DatabaseManager.updateQuery(context, delete);
if (map != null)
{
String deleteDistinct = "DELETE FROM " + map + " WHERE item_id IN ( SELECT item_id FROM " + map + " EXCEPT " + itemQuery + ")";
DatabaseManager.updateQuery(context, deleteDistinct);
}
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new BrowseException(e);
}
}
/* (non-Javadoc)
* @see org.dspace.browse.BrowseCreateDAO#testTableExistance(java.lang.String)
*/
public boolean testTableExistance(String table)
throws BrowseException
{
// this method can kill the db connection, so we start up
// our own private context to do it
Context c = null;
try
{
c = new Context();
String testQuery = "SELECT * FROM " + table + " LIMIT 1";
DatabaseManager.query(c, testQuery);
return true;
}
catch (SQLException e)
{
return false;
}
finally
{
if (c != null)
{
c.abort();
}
}
}
/**
* Get the definition of the sort_value column - always a VARCHAR2
* (required for ordering)
*
* @return
*/
private String getSortColumnDefinition()
{
int size = utils.getSortColumnMaxChars();
if (size < 1)
{
return " TEXT ";
}
return " VARCHAR(" + size + ") ";
}
/**
* Get the definition of the value column - TEXT if the size is greater than 4000 bytes
* otherwise a VARCHAR2.
*
* @return
*/
private String getValueColumnDefinition()
{
int size = utils.getValueColumnMaxChars();
if (size < 1)
{
return " TEXT ";
}
return " VARCHAR(" + size + ") ";
}
/**
* perform a database query to get all the communities that this item belongs to,
* including all mapped communities, and ancestors
*
* this is done here instead of using the Item api, because for reindexing we may
* not have Item objects, and in any case this is *much* faster
*
* @param itemId
* @return
* @throws SQLException
*/
private int[] getAllCommunityIDs(int itemId) throws SQLException
{
List<Integer> commIdList = new ArrayList<Integer>();
TableRowIterator tri = null;
try
{
tri = DatabaseManager.queryTable(context, "Community2Item",
"SELECT * FROM Community2Item WHERE item_id=?", itemId);
while (tri.hasNext())
{
TableRow row = tri.next();
int commId = row.getIntColumn("community_id");
commIdList.add(commId);
// Get the parent community, and continue to get all ancestors
Integer parentId = getParentCommunityID(commId);
while (parentId != null)
{
commIdList.add(parentId);
parentId = getParentCommunityID(parentId);
}
}
}
finally
{
if (tri != null)
tri.close();
}
// Need to iterate the array as toArray will produce an array Integers,
// not ints as we need.
int[] cIds = new int[commIdList.size()];
for (int i = 0; i < commIdList.size(); i++)
{
cIds[i] = commIdList.get(i);
}
return cIds;
}
/**
* Get the id of the parent community. Returns Integer, as null is used to
* signify that there are no parents (ie. top-level).
*
* @param commId
* @return
* @throws SQLException
*/
private Integer getParentCommunityID(int commId) throws SQLException
{
TableRowIterator tri = null;
try
{
tri = DatabaseManager.queryTable(context, "Community2Community",
"SELECT * FROM Community2Community WHERE child_comm_id=?", commId);
if (tri.hasNext())
{
return tri.next().getIntColumn("parent_comm_id");
}
}
finally
{
if (tri != null)
tri.close();
}
return null;
}
/**
* Check to see if the integer at pos is the first occurrence of that value
* in the array.
*
* @param ids
* @param pos
* @return
*/
private boolean isFirstOccurrence(int[] ids, int pos)
{
if (pos < 0 || pos >= ids.length)
return false;
int id = ids[pos];
for (int i = 0; i < pos; i++)
{
if (id == ids[i])
return false;
}
return true;
}
}

View File

@@ -0,0 +1,417 @@
/*
* BrowseDAO.java
*
* Version: $Revision: $
*
* Date: $Date: $
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
import java.util.List;
/**
* Interface for any class wishing to interact with the Browse storage layer for
* Read Only operations. If you wish to modify the contents of the browse indices
* or create and destroy index tables you should look at implementations for
* BrowseCreateDAO.
*
* If you implement this class, and you wish it to be loaded via the BrowseDAOFactory
* you must supply a constructor of the form:
*
* public BrowseDAOImpl(Context context) {}
*
* Where Context is the DSpace Context object
*
* Where tables are referred to in this class, they can be obtained from the BrowseIndex
* class, which will answer queries given the context of the request on which table
* is the relevant target.
*
* @author Richard Jones
*
*/
public interface BrowseDAO
{
// Objects implementing this interface should also include
// a constructor which takes the DSpace Context as an argument
//
// public BrowseDAOImpl(Context context) ...
/**
* This executes a query which will count the number of results for the
* parameters you set.
*
* @return the integer value of the number of results found
* @throws BrowseException
*/
public int doCountQuery() throws BrowseException;
/**
* This executes a query which returns a List object containing String
* values which represent the results of a single value browse (for
* example, the list of all subject headings). This is most
* commonly used with a Distinct browse type.
*
* @return List of Strings representing the single value query results
* @throws BrowseException
*/
public List doValueQuery() throws BrowseException;
/**
* This executes a query which returns a List object containing BrowseItem objects
* represening the results of a full item browse.
*
* @return List of BrowseItem objects
* @throws BrowseException
*/
public List doQuery() throws BrowseException;
/**
* This executes a query which returns the value of the "highest" (max) value
* in the given table's column for the given item id.
*
* @param column the column to interrogate
* @param table the table to query
* @param itemID the item id
* @return String representing the max value in the given column
* @throws BrowseException
*/
public String doMaxQuery(String column, String table, int itemID) throws BrowseException;
/**
* This executes a query which returns the offset where the value (or nearest greater
* equivalent) can be found in the specified table ordered by the column.
*
* @param column the column to interrogate
* @param value the item id
* @param isAscending browsing in ascending or descending order
* @return the offset into the table
* @throws BrowseException
*/
public int doOffsetQuery(String column, String value, boolean isAscending) throws BrowseException;
/**
* This executes a query which returns the offset where the value (or nearest greater
* equivalent) can be found in the specified table ordered by the column.
*
* @param column the column to interrogate
* @param value the item id
* @param isAscending browsing in ascending or descending order
* @return the offset into the table
* @throws BrowseException
*/
public int doDistinctOffsetQuery(String column, String value, boolean isAscending) throws BrowseException;
/**
* Does the query use the equals comparator when doing less than or greater than
* comparisons. @see setEqualsComparator
*
* Default value is true
*
* @return true if using it, false if not
*/
public boolean useEqualsComparator();
/**
* Set whether the query should use an equals comparator when doing less than or
* greater than comparisons. That is, if true then comparisons will be made
* using the equivalent of "<=" and ">=", while if false it will use the
* equivalent of "<" and ">"
*
* @param equalsComparator true to use, false to not.
*/
public void setEqualsComparator(boolean equalsComparator);
/**
* Is the sort order ascending or descending?
*
* Default value is true
*
* @return true for ascending, false for descending
*/
public boolean isAscending();
/**
* Set whether the results should be sorted in ascending order (on the given sort column)
* or descending order.
*
* @param ascending true to ascend, false to descend
*/
public void setAscending(boolean ascending);
/**
* Get the database ID of the container object. The container object will be a
* Community or a Collection.
*
* @return the database id of the container, or -1 if none is set
*/
public int getContainerID();
/**
* Set the database id of the container object. This should be the id of a
* Community or Collection. This will constrain the results of the browse
* to only items or values within items that appear in the given container.
*
* @param containerID
*/
public void setContainerID(int containerID);
/**
* get the name of the field in which to look for the container id. This is
* principally for use internal to the DAO.
*
* @return the name of the container id field. For example "collection_id" or
* "community_id"
*/
public String getContainerIDField();
/**
* set the name of the field in which to look for the container id.
*
* @param containerIDField the name of the container id field.
* For example "collection_id" or "community_id"
*/
public void setContainerIDField(String containerIDField);
/**
* Get the field in which we will match a focus value from which to start
* the browse. This will either be the "sort_value" field or one of the
* additional sort fields defined by configuration
*
* @return the name of the focus field
*/
public String getJumpToField();
/**
* Set the focus field upon which we will match a value from which to start
* the browse. This will either be the "sort_value" field or one of the
* additional sort fields defined by configuration
*
* param focusField the name of the focus field
*/
public void setJumpToField(String focusField);
/**
* Get the value at which the browse will start. The value supplied here will
* be the top result on the page of results.
*
* @return the value to start browsing on
*/
public String getJumpToValue();
/**
* Set the value upon which to start the browse from. The value supplied here
* will be the top result on the page of results
*
* @param focusValue the value in the focus field on which to start browsing
*/
public void setJumpToValue(String focusValue);
/**
* get the integer number which is the limit of the results that will be returned
* by any query. The default is -1, which means unlimited results.
*
* @return the maximum possible number of results allowed to be returned
*/
public int getLimit();
/**
* Set the limit for how many results should be returned. This is generally
* for use in paging or limiting the number of items be be displayed. The default
* is -1, meaning unlimited results. Note that if the number of results of the
* query is less than this number, the size of the result set will be smaller
* than this limit.
*
* @param limit the maximum number of results to return.
*/
public void setLimit(int limit);
/**
* Get the offset from the first result from which to return results. This
* functionality is present for backwards compatibility, but is ill advised. All
* normal browse operations can be completed without it. The default is -1, which
* means do not offset.
*
* @return the offset
*/
public int getOffset();
/**
* Get the offset from the first result from which to return results. This
* functionality is present for backwards compatibility, but is ill advised. All
* normal browse operations can be completed without it. The default is -1, which
* means do not offset.
*
* @param offset
*/
public void setOffset(int offset);
/**
* Get the database field which will be used to do the sorting of result sets on.
*
* @return the field by which results will be sorted
*/
public String getOrderField();
/**
* Set the database field which will be used to sort result sets on
*
* @param orderField the field by which results will be sorted
*/
public void setOrderField(String orderField);
/**
* Get the array of values that we will be selecting on. The default is
* to select all of the values from a given table
*
* @return an array of values to select on
*/
public String[] getSelectValues();
/**
* Set the array of values to select on. This should be a list of the columns
* available in the target table, or the SQL wildcards. The default is
* single element array with the standard wildcard (*)
*
* @param selectValues the values to select on
*/
public void setSelectValues(String[] selectValues);
/**
* Get the array of fields that we will be counting on.
*
* @return an array of fields to be counted over
*/
public String[] getCountValues();
/**
* Set the array of columns that we will be counting over. In general, the
* wildcard (*) will suffice
*
* @param fields an array of fields to be counted over
*/
public void setCountValues(String[] fields);
/**
* get the name of the table that we are querying
*
* @return the name of the table
*/
public String getTable();
/**
* Set the name of the table to query
*
* @param table the name of the table
*/
public void setTable(String table);
/**
* Set the name of the mapping tables to use for filtering
* @param tableDis the name of the table holding the distinct values
* @param tableMap the name of the table holding the mappings
*/
public void setFilterMappingTables(String tableDis, String tableMap);
/**
* Get the value which we are constraining all our browse results to contain.
*
* @return the value to which to constrain results
*/
public String getFilterValue();
/**
* Set the value to which all our browse results should be constrained. For
* example, if you are listing all of the publications by a single author
* your value would be the author name.
*
* @param value the value to which to constrain results
*/
public void setFilterValue(String value);
/**
* Sets whether we will treat the filter value as partial (like match), or exact
*
* @param part true if partial, false if exact
*/
public void setFilterValuePartial(boolean part);
/**
* Get the name of the field in which the value to constrain results is
* contained
*
* @return the name of the field
*/
public String getFilterValueField();
/**
* Set he name of the field in which the value to constrain results is
* contained
*
* @param valueField the name of the field
*/
public void setFilterValueField(String valueField);
/**
* Set whether this is a distinct value browse or not
*
* @param bool true if distinct value, false if not
*/
public void setDistinct(boolean bool);
/**
* Is this a distinct value browse?
*
* @return true if distinct, false if not
*/
public boolean isDistinct();
/**
* If we have specified a container id and container field, we must also specify
* a container table. This is the name of the table that maps the item onto
* the distinct value. Since we are in a container, this value will actually be
* the view which allows us to select only items which are within a given container
*
* @param containerTable the name of the container table mapping
*/
public void setContainerTable(String containerTable);
/**
* Get the name of the container table that is being used to map items to distinct
* values when in a container constrained browse
*
* @return the name of the table
*/
public String getContainerTable();
}

View File

@@ -0,0 +1,156 @@
/*
* BrowseDAOFactory.java
*
* Version: $Revision: $
*
* Date: $Date: $
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
import org.dspace.core.ConfigurationManager;
import org.dspace.core.Context;
/**
* Factory class to generate DAOs based on the configuration
*
* @author Richard Jones
*
*/
public class BrowseDAOFactory
{
/**
* Get an instance of the relevant Read Only DAO class, which will
* conform to the BrowseDAO interface
*
* @param context the DSpace context
* @return the relevant DAO
* @throws BrowseException
*/
public static BrowseDAO getInstance(Context context)
throws BrowseException
{
String db = ConfigurationManager.getProperty("db.name");
if ("postgres".equals(db))
{
return new BrowseDAOPostgres(context);
}
else if ("oracle".equals(db))
{
return new BrowseDAOOracle(context);
}
else
{
throw new BrowseException("The configuration for db.name is either invalid, or contains an unrecognised database");
}
}
/**
* Get an instance of the relevant Write Only DAO class, which will
* conform to the BrowseCreateDAO interface
*
* @param context the DSpace context
* @return the relevant DAO
* @throws BrowseException
*/
public static BrowseCreateDAO getCreateInstance(Context context)
throws BrowseException
{
String db = ConfigurationManager.getProperty("db.name");
if ("postgres".equals(db))
{
return new BrowseCreateDAOPostgres(context);
}
else if ("oracle".equals(db))
{
return new BrowseCreateDAOOracle(context);
}
else
{
throw new BrowseException("The configuration for db.name is either invalid, or contains an unrecognised database");
}
}
/**
* Get an instance of the relevant Read Only DAO class, which will
* conform to the BrowseItemDAO interface
*
* @param context the DSpace context
* @return the relevant DAO
* @throws BrowseException
*/
public static BrowseItemDAO getItemInstance(Context context)
throws BrowseException
{
String db = ConfigurationManager.getProperty("db.name");
if ("postgres".equals(db))
{
return new BrowseItemDAOPostgres(context);
}
else if ("oracle".equals(db))
{
return new BrowseItemDAOOracle(context);
}
else
{
throw new BrowseException("The configuration for db.name is either invalid, or contains an unrecognised database");
}
}
/**
* Get an instance of the relevant DAO Utilities class, which will
* conform to the BrowseDAOUtils interface
*
* @param context the DSpace context
* @return the relevant DAO
* @throws BrowseException
*/
public static BrowseDAOUtils getUtils(Context context)
throws BrowseException
{
String db = ConfigurationManager.getProperty("db.name");
if ("postgres".equals(db))
{
return new BrowseDAOUtilsPostgres();
}
else if ("oracle".equals(db))
{
return new BrowseDAOUtilsOracle();
}
else
{
throw new BrowseException("The configuration for db.name is either invalid, or contains an unrecognised database");
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,124 @@
/*
* BrowseDAOUtils.java
*
* Version: $Revision: $
*
* Date: $Date: $
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
/**
* Utility class for retrieving the size of the columns to be used in the browse tables,
* and applying truncation to the strings that will be inserted into the tables.
*
* Can be configured in dspace.cfg, with the following entries:
*
* webui.browse.value_columns.max
* - the maximum number of characters in 'value' columns
* (0 is unlimited)
*
* webui.browse.sort_columns.max
* - the maximum number of characters in 'sort' columns
* (0 is unlimited)
*
* webui.browse.value_columns.omission_mark
* - a string to append to truncated values that will be entered into
* the value columns (ie. '...')
*
* By default, the column sizes are '0' (unlimited), and no truncation is applied,
* EXCEPT for Oracle, where we have to truncate the columns for it to work! (in which
* case, both value and sort columns are by default limited to 2000 characters).
*
* @author Graham Triggs
* @author Richard Jones
*/
public interface BrowseDAOUtils
{
/**
* Get the size to use for the 'value' columns in characters
*
* @return
*/
public int getValueColumnMaxChars();
/**
* Get the size to use for the sort columns in characters
*
* @return
*/
public int getSortColumnMaxChars();
/**
* Truncate strings that are to be used for the 'value' columns
*
* @param value
* @return
*/
public String truncateValue(String value);
/**
* Truncate strings that are to be used for sorting
*
* @param value
* @return
*/
public String truncateSortValue(String value);
/**
* Truncate strings that are to be used for the 'value' columns.
* Characters is the maximum number of characters to allow.
* Actual truncation applied will be the SMALLER of the passed
* value, or that read from the configuration.
*
* @param value
* @param chars
* @return
* @deprecated
*/
public String truncateValue(String value, int chars);
/**
* Truncate strings that are to be used for the sorting
* Characters is the maximum number of characters to allow.
* Actual truncation applied will be the SMALLER of the passed
* value, or that read from the configuration.
*
* @param value
* @param chars
* @return
* @deprecated
*/
public String truncateSortValue(String value, int chars);
}

View File

@@ -0,0 +1,209 @@
/*
* BrowseDAOUtilsDefault.java
*
* Version: $Revision: $
*
* Date: $Date: $
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
import org.dspace.core.ConfigurationManager;
/**
* Utility class for retrieving the size of the columns to be used in the browse tables,
* and applying truncation to the strings that will be inserted into the tables.
*
* Can be configured in dspace.cfg, with the following entries:
*
* webui.browse.value_columns.max
* - the maximum number of characters in 'value' columns
* (0 is unlimited)
*
* webui.browse.sort_columns.max
* - the maximum number of characters in 'sort' columns
* (0 is unlimited)
*
* webui.browse.value_columns.omission_mark
* - a string to append to truncated values that will be entered into
* the value columns (ie. '...')
*
* By default, the column sizes are '0' (unlimited), and no truncation is applied,
* EXCEPT for Oracle, where we have to truncate the columns for it to work! (in which
* case, both value and sort columns are by default limited to 2000 characters).
*
* @author Graham Triggs
* @author Richard Jones
*/
public class BrowseDAOUtilsDefault implements BrowseDAOUtils
{
/** Maximum number of characters for value columns */
public int valueColumnMaxChars;
/** Maximum number of characters for sort columns */
public int sortColumnMaxChars;
/** string to insert where omissions have been made */
public String valueColumnOmissionMark;
/**
* Create a new instance of the Default set of utils to use with the database.
* This represents the most likely case with a database, in that it does not
* require the fields to be truncated. Other databases, such as Oracle, require
* a set limit for their VARCHAR fields, and will therefore have a slightly
* different implementation
*
* Other database implementations should extend this class for typing and
* future proofing purposes
*
*/
public BrowseDAOUtilsDefault()
{
// Default for all other databases is unlimited
valueColumnMaxChars = 0;
sortColumnMaxChars = 0;
if (ConfigurationManager.getProperty("webui.browse.value_columns.max") != null)
{
valueColumnMaxChars = ConfigurationManager.getIntProperty("webui.browse.value_columns.max");
}
if (ConfigurationManager.getProperty("webui.browse.sort_columns.max") != null)
{
sortColumnMaxChars = ConfigurationManager.getIntProperty("webui.browse.sort_columns.max");
}
valueColumnOmissionMark = ConfigurationManager.getProperty("webui.browse.value_columns.omission_mark");
if (valueColumnOmissionMark == null)
{
valueColumnOmissionMark = "...";
}
}
/**
* Get the size to use for the 'value' columns in characters
*
* @return
*/
public int getValueColumnMaxChars()
{
return this.valueColumnMaxChars;
}
/**
* Get the size to use for the sort columns in characters
*
* @return
*/
public int getSortColumnMaxChars()
{
return this.sortColumnMaxChars;
}
/**
* Truncate strings that are to be used for the 'value' columns
*
* @param value
* @return
*/
public String truncateValue(String value)
{
return this.trunctateString(value, this.valueColumnMaxChars, valueColumnOmissionMark);
}
/**
* Truncate strings that are to be used for sorting
*
* @param value
* @return
*/
public String truncateSortValue(String value)
{
return this.trunctateString(value, this.sortColumnMaxChars, null);
}
/**
* Truncate strings that are to be used for the 'value' columns.
* Characters is the maximum number of characters to allow.
* Actual truncation applied will be the SMALLER of the passed
* value, or that read from the configuration.
*
* @param value
* @param chars
* @return
* @deprecated
*/
public String truncateValue(String value, int chars)
{
return this.trunctateString(value, Math.min(chars, this.valueColumnMaxChars), valueColumnOmissionMark);
}
/**
* Truncate strings that are to be used for the sorting
* Characters is the maximum number of characters to allow.
* Actual truncation applied will be the SMALLER of the passed
* value, or that read from the configuration.
*
* @param value
* @param chars
* @return
* @deprecated
*/
public String truncateSortValue(String value, int chars)
{
return this.trunctateString(value, Math.min(chars, this.sortColumnMaxChars), null);
}
/**
* Internal method to apply the truncation.
*
* @param value
* @param maxChars
* @param omissionMark
* @return
*/
private String trunctateString(String value, int maxChars, String omissionMark)
{
if (value == null || maxChars < 1)
return value;
if (maxChars > value.length())
return value;
if (omissionMark != null && omissionMark.length() > 0)
return value.substring(0, maxChars - omissionMark.length()) + omissionMark;
return value.substring(0, maxChars);
}
}

View File

@@ -0,0 +1,107 @@
/*
* BrowseDAOUtilsOracle.java
*
* Version: $Revision: $
*
* Date: $Date: $
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
import org.dspace.core.ConfigurationManager;
/**
* Utility class for retrieving the size of the columns to be used in the browse tables,
* and applying truncation to the strings that will be inserted into the tables.
*
* Can be configured in dspace.cfg, with the following entries:
*
* webui.browse.value_columns.max
* - the maximum number of characters in 'value' columns
* (0 is unlimited)
*
* webui.browse.sort_columns.max
* - the maximum number of characters in 'sort' columns
* (0 is unlimited)
*
* webui.browse.value_columns.omission_mark
* - a string to append to truncated values that will be entered into
* the value columns (ie. '...')
*
* By default, the column sizes are '0' (unlimited), and no truncation is applied,
* EXCEPT for Oracle, where we have to truncate the columns for it to work! (in which
* case, both value and sort columns are by default limited to 2000 characters).
*
* @author Richard Jones
* @author Graham Triggs
*/
public class BrowseDAOUtilsOracle extends BrowseDAOUtilsDefault
{
/**
* Create a new instance of the Oracle specific set of utilities. This
* enforces a limit of 2000 characters on the value and sort columns
* in the database. Any configuration which falls outside this boundary
* will be automatically brought within it.
*
*/
public BrowseDAOUtilsOracle()
{
valueColumnMaxChars = 2000;
sortColumnMaxChars = 2000;
if (ConfigurationManager.getProperty("webui.browse.value_columns.max") != null)
{
valueColumnMaxChars = ConfigurationManager.getIntProperty("webui.browse.value_columns.max");
}
if (ConfigurationManager.getProperty("webui.browse.sort_columns.max") != null)
{
sortColumnMaxChars = ConfigurationManager.getIntProperty("webui.browse.sort_columns.max");
}
// For Oracle, force the sort column to be no more than 2000 characters,
// even if explicitly configured (have to deal with limitation of using VARCHAR2)
if (sortColumnMaxChars < 1 || sortColumnMaxChars > 2000)
{
sortColumnMaxChars = 2000;
}
valueColumnOmissionMark = ConfigurationManager.getProperty("webui.browse.value_columns.omission_mark");
if (valueColumnOmissionMark == null)
{
valueColumnOmissionMark = "...";
}
}
}

View File

@@ -0,0 +1,79 @@
/*
* BrowseDAOUtilsPostgres.java
*
* Version: $Revision: $
*
* Date: $Date: $
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
/**
* Utility class for retrieving the size of the columns to be used in the browse tables,
* and applying truncation to the strings that will be inserted into the tables.
*
* Can be configured in dspace.cfg, with the following entries:
*
* webui.browse.value_columns.max
* - the maximum number of characters in 'value' columns
* (0 is unlimited)
*
* webui.browse.sort_columns.max
* - the maximum number of characters in 'sort' columns
* (0 is unlimited)
*
* webui.browse.value_columns.omission_mark
* - a string to append to truncated values that will be entered into
* the value columns (ie. '...')
*
* By default, the column sizes are '0' (unlimited), and no truncation is applied,
* EXCEPT for Oracle, where we have to truncate the columns for it to work! (in which
* case, both value and sort columns are by default limited to 2000 characters).
*
* @author Richard Jones
*/
public class BrowseDAOUtilsPostgres extends BrowseDAOUtilsDefault
{
/**
* This is really just a type cast at the moment so we have a Postgres
* specific set of utils. In reality, this is identical to the
* Default class which it extends.
*
*/
public BrowseDAOUtilsPostgres()
{
super();
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,70 @@
/*
* BrowseException.java
*
* Version: $Revision: $
*
* Date: $Date: $
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
/**
* Just a quick BrowseException class to give us the relevant data type
*
* @author Richard Jones
*/
public class BrowseException extends Exception
{
public BrowseException()
{
super();
}
public BrowseException(String message)
{
super(message);
}
public BrowseException(String message, Throwable cause)
{
super(message, cause);
}
public BrowseException(Throwable cause)
{
super(cause);
}
}

View File

@@ -0,0 +1,806 @@
/*
* BrowseIndex.java
*
* Version: $Revision: $
*
* Date: $Date: $
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.dspace.core.ConfigurationManager;
import org.dspace.sort.SortOption;
import org.dspace.sort.SortException;
/**
* This class holds all the information about a specifically configured
* BrowseIndex. It is responsible for parsing the configuration, understanding
* about what sort options are available, and what the names of the database
* tables that hold all the information are actually called.
*
* @author Richard Jones
*/
public class BrowseIndex
{
/** the configuration number, as specified in the config */
/** used for single metadata browse tables for generating the table name */
private int number;
/** the name of the browse index, as specified in the config */
private String name;
/** the SortOption for this index (only valid for item indexes) */
private SortOption sortOption;
/** the value of the metadata, as specified in the config */
private String metadataAll;
/** the metadata fields, as an array */
private String[] metadata;
/** the datatype of the index, as specified in the config */
private String datatype;
/** the display type of the metadata, as specified in the config */
private String displayType;
/** base name for tables, sequences */
private String tableBaseName;
/** a three part array of the metadata bits (e.g. dc.contributor.author) */
private String[][] mdBits;
/** default order (asc / desc) for this index */
private String defaultOrder = SortOption.ASCENDING;
/** additional 'internal' tables that are always defined */
private static BrowseIndex itemIndex = new BrowseIndex("bi_item");
private static BrowseIndex withdrawnIndex = new BrowseIndex("bi_withdrawn");
/**
* Ensure noone else can create these
*/
private BrowseIndex()
{
}
/**
* Constructor for creating generic / internal index objects
* @param baseName The base of the table name
*/
private BrowseIndex(String baseName)
{
try
{
number = -1;
tableBaseName = baseName;
displayType = "item";
sortOption = SortOption.getDefaultSortOption();
}
catch (SortException se)
{
// FIXME Exception handling
}
}
/**
* Create a new BrowseIndex object using the definition from the configuration,
* and the number of the configuration option. The definition should be of
* the form:
*
* <code>
* [name]:[metadata]:[data type]:[display type]
* </code>
*
* [name] is a freetext name for the field
* [metadata] is the usual format of the metadata such as dc.contributor.author
* [data type] must be either "title", "date" or "text"
* [display type] must be either "single" or "full"
*
* @param definition the configuration definition of this index
* @param number the configuration number of this index
* @throws BrowseException
*/
private BrowseIndex(String definition, int number)
throws BrowseException
{
try
{
boolean valid = true;
this.defaultOrder = SortOption.ASCENDING;
this.number = number;
String rx = "(\\w+):(\\w+):([\\w\\.\\*,]+):?(\\w*):?(\\w*)";
Pattern pattern = Pattern.compile(rx);
Matcher matcher = pattern.matcher(definition);
if (matcher.matches())
{
name = matcher.group(1);
displayType = matcher.group(2);
if (isMetadataIndex())
{
metadataAll = matcher.group(3);
datatype = matcher.group(4);
if (metadataAll != null)
metadata = metadataAll.split(",");
if (metadata == null || metadata.length == 0)
valid = false;
if (datatype == null || datatype.equals(""))
valid = false;
// If an optional ordering configuration is supplied,
// set the defaultOrder appropriately (asc or desc)
if (matcher.groupCount() > 4)
{
String order = matcher.group(5);
if (SortOption.DESCENDING.equalsIgnoreCase(order))
this.defaultOrder = SortOption.DESCENDING;
}
tableBaseName = getItemBrowseIndex().tableBaseName;
}
else if (isItemIndex())
{
String sortName = matcher.group(3);
for (SortOption so : SortOption.getSortOptions())
{
if (so.getName().equals(sortName))
sortOption = so;
}
if (sortOption == null)
valid = false;
// If an optional ordering configuration is supplied,
// set the defaultOrder appropriately (asc or desc)
if (matcher.groupCount() > 3)
{
String order = matcher.group(4);
if (SortOption.DESCENDING.equalsIgnoreCase(order))
this.defaultOrder = SortOption.DESCENDING;
}
tableBaseName = getItemBrowseIndex().tableBaseName;
}
else
{
valid = false;
}
}
else
{
valid = false;
}
if (!valid)
{
throw new BrowseException("Browse Index configuration is not valid: webui.browse.index." +
number + " = " + definition);
}
}
catch (SortException se)
{
throw new BrowseException("Error in SortOptions", se);
}
}
/**
* @return Default order for this index, null if not specified
*/
public String getDefaultOrder()
{
return defaultOrder;
}
/**
* @return Returns the datatype.
*/
public String getDataType()
{
if (sortOption != null)
return sortOption.getType();
return datatype;
}
/**
* @return Returns the displayType.
*/
public String getDisplayType()
{
return displayType;
}
/**
* @return Returns the number of metadata fields for this index
*/
public int getMetadataCount()
{
if (isMetadataIndex())
return metadata.length;
return 0;
}
/**
* @return Returns the mdBits.
*/
public String[] getMdBits(int idx)
{
if (isMetadataIndex())
return mdBits[idx];
return null;
}
/**
* @return Returns the metadata.
*/
public String getMetadata()
{
return metadataAll;
}
public String getMetadata(int idx)
{
return metadata[idx];
}
/**
* @return Returns the name.
*/
public String getName()
{
return name;
}
/**
* @param name The name to set.
*/
// public void setName(String name)
// {
// this.name = name;
// }
/**
* Get the SortOption associated with this index.
*/
public SortOption getSortOption()
{
return sortOption;
}
/**
* Populate the internal array containing the bits of metadata, for
* ease of use later
*/
public void generateMdBits()
{
try
{
if (isMetadataIndex())
{
mdBits = new String[metadata.length][];
for (int i = 0; i < metadata.length; i++)
{
mdBits[i] = interpretField(metadata[i], null);
}
}
}
catch(IOException e)
{
// it's not obvious what we really ought to do here
//log.error("caught exception: ", e);
}
}
/**
* Get the name of the sequence that will be used in the given circumnstances
*
* @param isDistinct is a distinct table
* @param isMap is a map table
* @return the name of the sequence
*/
public String getSequenceName(boolean isDistinct, boolean isMap)
{
if (isDistinct || isMap)
return BrowseIndex.getSequenceName(number, isDistinct, isMap);
return BrowseIndex.getSequenceName(tableBaseName, isDistinct, isMap);
}
/**
* Get the name of the sequence that will be used in the given circumstances
*
* @param number the index configuration number
* @param isDistinct is a distinct table
* @param isMap is a map table
* @return the name of the sequence
*/
public static String getSequenceName(int number, boolean isDistinct, boolean isMap)
{
return BrowseIndex.getSequenceName(makeTableBaseName(number), isDistinct, isMap);
}
/**
* Generate a sequence name from the given base
* @param baseName
* @param isDistinct
* @param isMap
* @return
*/
private static String getSequenceName(String baseName, boolean isDistinct, boolean isMap)
{
if (isDistinct)
{
baseName = baseName + "_dis";
}
else if (isMap)
{
baseName = baseName + "_dmap";
}
baseName = baseName + "_seq";
return baseName;
}
/**
* Get the name of the table for the given set of circumstances
* This is provided solely for cleaning the database, where you are
* trying to create table names that may not be reflected in the current index
*
* @param number the index configuration number
* @param isCommunity whether this is a community constrained index (view)
* @param isCollection whether this is a collection constrainted index (view)
* @param isDistinct whether this is a distinct table
* @param isMap whether this is a distinct map table
* @return the name of the table
* @deprecated 1.5
*/
public static String getTableName(int number, boolean isCommunity, boolean isCollection, boolean isDistinct, boolean isMap)
{
return BrowseIndex.getTableName(makeTableBaseName(number), isCommunity, isCollection, isDistinct, isMap);
}
/**
* Generate a table name from the given base
* @param baseName
* @param isCommunity
* @param isCollection
* @param isDistinct
* @param isMap
* @return
*/
private static String getTableName(String baseName, boolean isCommunity, boolean isCollection, boolean isDistinct, boolean isMap)
{
// isDistinct is meaningless in relation to isCommunity and isCollection
// so we bounce that back first, ignoring other arguments
if (isDistinct)
{
return baseName + "_dis";
}
// isCommunity and isCollection are mutually exclusive
if (isCommunity)
{
baseName = baseName + "_com";
}
else if (isCollection)
{
baseName = baseName + "_col";
}
// isMap is additive to isCommunity and isCollection
if (isMap)
{
baseName = baseName + "_dmap";
}
return baseName;
}
/**
* Get the name of the table in the given circumstances
*
* @param isCommunity whether this is a community constrained index (view)
* @param isCollection whether this is a collection constrainted index (view)
* @param isDistinct whether this is a distinct table
* @param isMap whether this is a distinct map table
* @return the name of the table
* @deprecated 1.5
*/
public String getTableName(boolean isCommunity, boolean isCollection, boolean isDistinct, boolean isMap)
{
if (isDistinct || isMap)
return BrowseIndex.getTableName(number, isCommunity, isCollection, isDistinct, isMap);
return BrowseIndex.getTableName(tableBaseName, isCommunity, isCollection, isDistinct, isMap);
}
/**
* Get the name of the table in the given circumstances. This is the same as calling
*
* <code>
* getTableName(isCommunity, isCollection, false, false);
* </code>
*
* @param isCommunity whether this is a community constrained index (view)
* @param isCollection whether this is a collection constrainted index (view)
* @return the name of the table
* @deprecated 1.5
*/
public String getTableName(boolean isCommunity, boolean isCollection)
{
return getTableName(isCommunity, isCollection, false, false);
}
/**
* Get the default index table name. This is the same as calling
*
* <code>
* getTableName(false, false, false, false);
* </code>
*
* @return
*/
public String getTableName()
{
return getTableName(false, false, false, false);
}
/**
* Get the table name for the given set of circumstances
*
* This is the same as calling:
*
* <code>
* getTableName(isCommunity, isCollection, isDistinct, false);
* </code>
*
* @param isDistinct is this a distinct table
* @param isCommunity
* @param isCollection
* @return
* @deprecated 1.5
*/
public String getTableName(boolean isDistinct, boolean isCommunity, boolean isCollection)
{
return getTableName(isCommunity, isCollection, isDistinct, false);
}
/**
* Get the default name of the distinct map table. This is the same as calling
*
* <code>
* getTableName(false, false, false, true);
* </code>
*
* @return
*/
public String getMapTableName()
{
return getTableName(false, false, false, true);
}
/**
* Get the default name of the distinct table. This is the same as calling
*
* <code>
* getTableName(false, false, true, false);
* </code>
*
* @return
*/
public String getDistinctTableName()
{
return getTableName(false, false, true, false);
}
/**
* Get the name of the colum that is used to store the default value column
*
* @return the name of the value column
*/
public String getValueColumn()
{
if (!isDate())
{
return "sort_text_value";
}
else
{
return "text_value";
}
}
/**
* Get the name of the primary key index column
*
* @return the name of the primary key index column
*/
public String getIndexColumn()
{
return "id";
}
/**
* Is this browse index type for a title?
*
* @return true if title type, false if not
*/
// public boolean isTitle()
// {
// return "title".equals(getDataType());
// }
/**
* Is the browse index type for a date?
*
* @return true if date type, false if not
*/
public boolean isDate()
{
return "date".equals(getDataType());
}
/**
* Is the browse index type for a plain text type?
*
* @return true if plain text type, false if not
*/
// public boolean isText()
// {
// return "text".equals(getDataType());
// }
/**
* Is the browse index of display type single?
*
* @return true if singe, false if not
*/
public boolean isMetadataIndex()
{
return "metadata".equals(displayType);
}
/**
* Is the browse index of display type full?
*
* @return true if full, false if not
*/
public boolean isItemIndex()
{
return "item".equals(displayType);
}
/**
* Get the field for sorting associated with this index
* @return
* @throws BrowseException
*/
public String getSortField(boolean isSecondLevel) throws BrowseException
{
String focusField;
if (isMetadataIndex() && !isSecondLevel)
{
focusField = "sort_value";
}
else
{
if (sortOption != null)
focusField = "sort_" + sortOption.getNumber();
else
focusField = "sort_1"; // Use the first sort column
}
return focusField;
}
/**
* @deprecated
* @return
* @throws BrowseException
*/
public static String[] tables()
throws BrowseException
{
BrowseIndex[] bis = getBrowseIndices();
String[] returnTables = new String[bis.length];
for (int i = 0; i < bis.length; i++)
{
returnTables[i] = bis[i].getTableName();
}
return returnTables;
}
/**
* Get an array of all the browse indices for the current configuration
*
* @return an array of all the current browse indices
* @throws BrowseException
*/
public static BrowseIndex[] getBrowseIndices()
throws BrowseException
{
int idx = 1;
String definition;
ArrayList browseIndices = new ArrayList();
while ( ((definition = ConfigurationManager.getProperty("webui.browse.index." + idx))) != null)
{
BrowseIndex bi = new BrowseIndex(definition, idx);
browseIndices.add(bi);
idx++;
}
BrowseIndex[] bis = new BrowseIndex[browseIndices.size()];
bis = (BrowseIndex[]) browseIndices.toArray((BrowseIndex[]) bis);
return bis;
}
/**
* Get the browse index from configuration with the specified name.
* The name is the first part of the browse configuration
*
* @param name the name to retrieve
* @return the specified browse index
* @throws BrowseException
*/
public static BrowseIndex getBrowseIndex(String name)
throws BrowseException
{
for (BrowseIndex bix : BrowseIndex.getBrowseIndices())
{
if (bix.getName().equals(name))
return bix;
}
return null;
}
/**
* Get the configured browse index that is defined to use this sort option
*
* @param so
* @return
* @throws BrowseException
*/
public static BrowseIndex getBrowseIndex(SortOption so) throws BrowseException
{
for (BrowseIndex bix : BrowseIndex.getBrowseIndices())
{
if (bix.getSortOption() == so)
return bix;
}
return null;
}
/**
* Get the internally defined browse index for archived items
*
* @return
*/
public static BrowseIndex getItemBrowseIndex()
{
return BrowseIndex.itemIndex;
}
/**
* Get the internally defined browse index for withdrawn items
* @return
*/
public static BrowseIndex getWithdrawnBrowseIndex()
{
return BrowseIndex.withdrawnIndex;
}
/**
* Take a string representation of a metadata field, and return it as an array.
* This is just a convenient utility method to basically break the metadata
* representation up by its delimiter (.), and stick it in an array, inserting
* the value of the init parameter when there is no metadata field part.
*
* @param mfield the string representation of the metadata
* @param init the default value of the array elements
* @return a three element array with schema, element and qualifier respectively
*/
public String[] interpretField(String mfield, String init)
throws IOException
{
StringTokenizer sta = new StringTokenizer(mfield, ".");
String[] field = {init, init, init};
int i = 0;
while (sta.hasMoreTokens())
{
field[i++] = sta.nextToken();
}
// error checks to make sure we have at least a schema and qualifier for both
if (field[0] == null || field[1] == null)
{
throw new IOException("at least a schema and element be " +
"specified in configuration. You supplied: " + mfield);
}
return field;
}
/**
* Does the browse index represent one of the internal item indexes
*
* @param bi
* @return
*/
public static boolean isInternalIndex(BrowseIndex bi)
{
return (bi == itemIndex || bi == withdrawnIndex);
}
/**
* Does this browse index represent one of the internal item indexes
*
* @return
*/
public boolean isInternalIndex()
{
return (this == itemIndex || this == withdrawnIndex);
}
/**
* Generate a base table name
* @param number
* @return
*/
private static String makeTableBaseName(int number)
{
return "bi_" + Integer.toString(number);
}
}

View File

@@ -0,0 +1,937 @@
/*
* BrowseInfo.java
*
* Version: $Revision$
*
* Date: $Date$
*
* Copyright (c) 2002-2005, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
import java.sql.SQLException;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.dspace.content.Collection;
import org.dspace.content.Community;
import org.dspace.content.DCValue;
import org.dspace.content.DSpaceObject;
import org.dspace.content.Item;
import org.dspace.core.Context;
import org.dspace.sort.SortOption;
/**
* The results of a Browse, including all the contextual information about
* the query, as well as the results and associated information to create
* pagable navigation.
*
* @author Richard Jones
*/
public class BrowseInfo
{
/**
* The results of the browse.
*/
private List results;
/**
* The position of the first element of results within the Browse index.
* Positions begin with 0.
*/
private int overallPosition;
/**
* The position of the requested object within the results. Offsets begin
* with 0.
*/
private int offset;
/**
* The total number of items in the browse index.
*/
private int total;
/**
* True if this browse was cached.
*/
private boolean cached;
/** the browse index to which this pertains */
private BrowseIndex browseIndex;
/** the sort option being used */
private SortOption sortOption;
/** is the browse ascending or descending */
private boolean ascending;
/** what level of browse are we in? full and single front pages are 0, single value browse is 1 */
private int level = 0;
/** the value browsed upon */
private String value;
/** is this a "starts_with" browse? */
private boolean startsWith = false;
/** Collection we are constrained to */
private Collection collection;
/** Community we are constrained to */
private Community community;
/** offset of the item at the top of the next page */
private int nextOffset = -1;
/** offset of the item at the top of the previous page */
private int prevOffset = -1;
/** the value upon which we are focussing */
private String focus;
/** number of resutls to display per page */
private int resultsPerPage = -1;
/** database id of the item upon which we are focussing */
private int focusItem = -1;
/** number of metadata elements to display before truncating using "et al" */
private int etAl = -1;
/**
* Constructor
*
* @param results
* A List of Browse results
* @param overallPosition
* The position of the first returned item in the overall index
* @param total
* The total number of items in the index
* @param offset
* The position of the requested item in the set of results
*/
public BrowseInfo(List results, int overallPosition, int total, int offset)
{
if (results == null)
{
throw new IllegalArgumentException("Null result list not allowed");
}
this.results = Collections.unmodifiableList(results);
this.overallPosition = overallPosition;
this.total = total;
this.offset = offset;
}
/**
* @return the number of metadata fields at which to truncate with "et al"
*/
public int getEtAl()
{
return etAl;
}
/**
* set the number of metadata fields at which to truncate with "et al"
*
* @param etAl
*/
public void setEtAl(int etAl)
{
this.etAl = etAl;
}
/**
* @return Returns the focusItem.
*/
public int getFocusItem()
{
return focusItem;
}
/**
* @param focusItem The focusItem to set.
*/
public void setFocusItem(int focusItem)
{
this.focusItem = focusItem;
}
/**
* Does this browse have an item focus (as opposed to one of: no focus,
* a value focus)
*
* @return true if item focus, false if not
*/
public boolean hasItemFocus()
{
if (focusItem == -1)
{
return false;
}
return true;
}
/**
* @return Returns the resultsPerPage.
*/
public int getResultsPerPage()
{
return resultsPerPage;
}
/**
* @param resultsPerPage The resultsPerPage to set.
*/
public void setResultsPerPage(int resultsPerPage)
{
this.resultsPerPage = resultsPerPage;
}
/**
* Is there a value associated with this browse
*
* @return true if a value, false if not
*/
public boolean hasValue()
{
if (this.value != null)
{
return true;
}
return false;
}
/**
* Are there results for this browse, or was the result set empty?
*
* @return true if results, false if not
*/
public boolean hasResults()
{
if (results.size() > 0)
{
return true;
}
return false;
}
/**
* @param focus the value to focus the browse around
*/
public void setFocus(String focus)
{
this.focus = focus;
}
/**
* @return the value to focus the browse around
*/
public String getFocus()
{
return this.focus;
}
/**
* Set the DSpaceObject that is the container for this browse. If this
* is not of type Collection or Community, this method will throw an
* exception
*
* @param dso the container object; a Community or Collection
* @throws BrowseException
*/
public void setBrowseContainer(DSpaceObject dso)
throws BrowseException
{
if (dso instanceof Collection)
{
this.collection = (Collection) dso;
}
else if (dso instanceof Community)
{
this.community = (Community) dso;
}
else
{
throw new BrowseException("The container must be a community or a collection");
}
}
/**
* Obtain a DSpaceObject that represents the container object. This will be
* a Community or a Collection
*
* @return A DSpaceObject representing a Community or a Collection
*/
public DSpaceObject getBrowseContainer()
{
if (this.collection != null)
{
return this.collection;
}
if (this.community != null)
{
return this.community;
}
return null;
}
/**
* @param level the browse level
*/
public void setBrowseLevel(int level)
{
this.level = level;
}
/**
* @return the browse level
*/
public int getBrowseLevel()
{
return this.level;
}
/**
* @param id the database id of the item at the top of the next page
*/
public void setNextOffset(int offset)
{
this.nextOffset = offset;
}
/**
* @return the database id of the item at the top of the next page
*/
public int getNextOffset()
{
return this.nextOffset;
}
/**
* @return Returns the ascending.
*/
public boolean isAscending()
{
return ascending;
}
/**
* @param ascending The ascending to set.
*/
public void setAscending(boolean ascending)
{
this.ascending = ascending;
}
/**
* @return Returns the browseIndex.
*/
public BrowseIndex getBrowseIndex()
{
return browseIndex;
}
/**
* @param browseIndex The browseIndex to set.
*/
public void setBrowseIndex(BrowseIndex browseIndex)
{
this.browseIndex = browseIndex;
}
/**
* @return Returns the prevItem.
*/
public int getPrevOffset()
{
return prevOffset > -1 ? prevOffset : 0;
}
/**
* @param prevItem The prevItem to set.
*/
public void setPrevOffset(int prevOffset)
{
this.prevOffset = prevOffset;
}
/**
* @return Returns the sortOption.
*/
public SortOption getSortOption()
{
return sortOption;
}
/**
* @param sortOption The sortOption to set.
*/
public void setSortOption(SortOption sortOption)
{
this.sortOption = sortOption;
}
/**
* @return Returns the startsWith.
*/
public boolean isStartsWith()
{
return startsWith;
}
/**
* @param startsWith The startsWith to set.
*/
public void setStartsWith(boolean startsWith)
{
this.startsWith = startsWith;
}
/**
* @return Returns the value.
*/
public String getValue()
{
return value;
}
/**
* @param value The value to set.
*/
public void setValue(String value)
{
this.value = value;
}
/**
* is this a top level (0) browse? Examples of this are a full item
* browse or a single browse. Other browse types are considered
* second level (1)
*
* @return true if top level, false if not
*/
public boolean isTopLevel()
{
if (this.level == 0)
{
return true;
}
return false;
}
/**
* Is this a second level (1) browse? Examples of this are a single
* value browse (e.g. all items by a given author)
*
* @return true if second level, false if not
*/
public boolean isSecondLevel()
{
if (this.level == 1)
{
return true;
}
return false;
}
/**
* The results of the Browse. Each member of the list is either a String
* (for the authors browse) or an {@link org.dspace.content.Item}(for the
* other browses).
*
* @return Result list. This list cannot be modified.
*/
public List getResults()
{
return results;
}
/**
* Return the results of the Browse as a String array.
*
* @return The results of the Browse as a String array.
*/
public String[] getStringResults()
{
return (String[]) results.toArray(new String[results.size()]);
}
/**
* @deprecated
* @return
*/
public Item[] getItemResults()
{
return new Item[0];
}
/**
* Return the results of the Browse as an Item array.
*
* @return The results of the Browse as an Item array.
*/
public Item[] getItemResults(Context context)
throws BrowseException
{
try
{
BrowseItem[] bis = getBrowseItemResults();
Item[] items = new Item[bis.length];
for (int i = 0; i < bis.length; i++)
{
items[i] = Item.find(context, bis[i].getID());
}
return items;
}
catch (SQLException e)
{
throw new BrowseException(e);
}
}
/**
* Return the results of the Browse as a BrowseItem array
*
* @return the results of the browse as a BrowseItem array
*/
public BrowseItem[] getBrowseItemResults()
{
return (BrowseItem[]) results.toArray(new BrowseItem[results.size()]);
}
/**
* Return the number of results.
*
* @return The number of results.
*/
public int getResultCount()
{
return results.size();
}
/**
* Return the position of the results in index being browsed. This is 0 for
* the start of the index.
*
* @return The position of the results in index being browsed.
*/
public int getOverallPosition()
{
return overallPosition;
}
/**
* Return the total number of items in the index.
*
* @return The total number of items in the index.
*/
public int getTotal()
{
return total;
}
/**
* Return the position of the requested item or value in the set of results.
*
* @return The position of the requested item or value in the set of results
*/
public int getOffset()
{
return offset;
}
/**
* True if there are no previous results from the browse.
*
* @return True if there are no previous results from the browse
*/
public boolean isFirst()
{
return overallPosition == 0;
}
/**
* True if these are the last results from the browse.
*
* @return True if these are the last results from the browse
*/
public boolean isLast()
{
return (overallPosition + getResultCount()) == total;
}
/**
* True if this browse was cached.
*/
public boolean wasCached()
{
return cached;
}
/**
* Set whether this browse was cached.
*/
void setCached(boolean cached)
{
this.cached = cached;
}
/**
* are we browsing within a Community container?
*
* @return true if in community, false if not
*/
public boolean inCommunity()
{
if (this.community != null)
{
return true;
}
return false;
}
/**
* are we browsing within a Collection container
*
* @return true if in collection, false if not
*/
public boolean inCollection()
{
if (this.collection != null)
{
return true;
}
return false;
}
/**
* Are there further results for the browse that haven't been returned yet?
*
* @return true if next page, false if not
*/
public boolean hasNextPage()
{
if (nextOffset > -1)
{
return true;
}
return false;
}
/**
* Are there results prior to these that haven't been returned here?
*
* @return true if previous page, false if not
*/
public boolean hasPrevPage()
{
if (offset > 0)
{
return true;
}
return false;
}
/**
* Does this browse have a focus?
*
* @return true if focus, false if not
*/
public boolean hasFocus()
{
if ("".equals(focus) || focus == null)
{
return false;
}
return true;
}
/**
* Get an integer representing the number within the total set of results which
* marks the position of the first result in the current sub-set
*
* @return the start point of the browse page
*/
public int getStart()
{
return overallPosition + 1;
}
/**
* Get an integer representing the number within the total set of results which
* marks the poisition of the last result in the current sub-set
*
* @return the end point of the browse page
*/
public int getFinish()
{
return overallPosition + results.size();
}
/**
* Utility method for obtaining a string representation of the browse. This is
* useful only for debug
*/
public String toString()
{
try
{
StringBuffer sb = new StringBuffer();
// calculate the range for display
String from = Integer.toString(overallPosition + 1);
String to = Integer.toString(overallPosition + results.size());
String of = Integer.toString(total);
// report on the positional information of the browse
sb.append("BrowseInfo String Representation: ");
sb.append("Browsing " + from + " to " + to + " of " + of + " ");
// insert the information about which index
sb.append("in index: " + browseIndex.getName() +
" (data type: " + browseIndex.getDataType() +
", display type: " + browseIndex.getDisplayType() + ") ");
sb.append("||");
// report on the browse scope container
String container = "all of DSpace";
DSpaceObject theContainer = null;
if (inCollection())
{
container = "collection";
theContainer = this.collection;
}
else if (inCommunity())
{
container = "community";
theContainer = this.community;
}
String containerID = "no id available/necessary";
if (theContainer != null)
{
containerID = Integer.toString(theContainer.getID()) + " (" + theContainer.getHandle() + ")";
}
sb.append("Browsing in " + container + ": " + containerID);
sb.append("||");
// load the item list display configuration
ItemListConfig config = new ItemListConfig();
// some information about the columns to be displayed
if (browseIndex.isItemIndex())
{
sb.append("Listing over " + Integer.toString(config.numCols()) + " columns: ");
for (int k = 1; k <= config.numCols(); k++)
{
if (k > 1)
{
sb.append(",");
}
String[] meta = config.getMetadata(k);
sb.append(meta[0] + "." + meta[1] + "." + meta[2]);
}
if (value != null)
{
sb.append(" on value: " + value);
}
if (isStartsWith())
{
sb.append(" sort column starting with: " + focus);
}
else if (hasFocus())
{
sb.append(" sort column focus: " + focus);
}
}
else if (browseIndex.isMetadataIndex())
{
sb.append("Listing single column: " + browseIndex.getMetadata());
if (isStartsWith())
{
sb.append(" sort column starting with: " + focus);
}
else if (hasFocus())
{
sb.append(" sort column focus: " + focus);
}
}
sb.append("||");
// some information about how the data is sorted
String direction = (ascending ? "ASC" : "DESC");
sb.append("Sorting by: " + sortOption.getMetadata() + " " + direction +
" (option " + Integer.toString(sortOption.getNumber()) + ")");
sb.append("||");
// output the results
if (browseIndex.isMetadataIndex() && !isSecondLevel())
{
sb.append(valueListingString());
}
else if (browseIndex.isItemIndex() || isSecondLevel())
{
sb.append(fullListingString(config));
}
sb.append("||");
// tell us what the next and previous values are going to be
sb.append("Top of next page: ");
if (hasNextPage())
{
sb.append("offset: " + Integer.toString(this.nextOffset));
}
else
{
sb.append("n/a");
}
sb.append(";");
sb.append("Top of previous page: ");
if (hasPrevPage())
{
sb.append("offset: " + Integer.toString(this.prevOffset));
}
else
{
sb.append("n/a");
}
sb.append("||");
return sb.toString();
}
catch (SQLException e)
{
return e.getMessage();
}
catch (BrowseException e)
{
return e.getMessage();
}
}
/**
* A utility method for generating a string to represent a single item's
* entry in the browse
*
* @param config
* @return
* @throws SQLException
*/
private String fullListingString(ItemListConfig config)
throws SQLException
{
// report on all the results contained herein
StringBuffer sb = new StringBuffer();
Iterator itr = results.iterator();
while (itr.hasNext())
{
BrowseItem bi = (BrowseItem) itr.next();
if (bi == null)
{
sb.append("{{ NULL ITEM }}");
break;
}
sb.append("{{Item ID: " + Integer.toString(bi.getID()) + " :: ");
for (int j = 1; j <= config.numCols(); j++)
{
String[] md = config.getMetadata(j);
if (md == null)
{
sb.append("{{ NULL METADATA }}");
break;
}
DCValue[] values = bi.getMetadata(md[0], md[1], md[2], Item.ANY);
StringBuffer value = new StringBuffer();
if (values != null)
{
for (int i = 0; i < values.length; i++)
{
if (i > 0)
{
value.append(",");
}
value.append(values[i].value);
}
}
else
{
value.append("-");
}
String metadata = "[" + md[0] + "." + md[1] + "." + md[2] + ":" + value.toString() + "]";
sb.append(metadata);
}
sb.append("}}");
}
return sb.toString();
}
/**
* A utility method for representing a single value in the browse
*
* @return
*/
private String valueListingString()
{
// report on all the results contained herein
StringBuffer sb = new StringBuffer();
Iterator itr = results.iterator();
while (itr.hasNext())
{
String theValue = (String) itr.next();
if (theValue == null)
{
sb.append("{{ NULL VALUE }}");
break;
}
sb.append("{{Value: " + theValue + "}}");
}
return sb.toString();
}
}

View File

@@ -0,0 +1,428 @@
/*
* BrowseItem.java
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
import org.apache.log4j.Logger;
import org.dspace.authorize.AuthorizeManager;
import org.dspace.content.*;
import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.dspace.handle.HandleManager;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
/**
* Entity class to represent an item that is being used to generate Browse
* results. This behaves in many was similar to the Item object, but its
* metadata handling has been further optimised for performance in both
* reading and writing, and it does not deal with other objects related to
* items
*
* FIXME: this class violates some of the encapsulation of the Item, but there is
* unfortunately no way around this until DAOs and an interface are provided
* for the Item class.
*
* @author Richard Jones
*
*/
public class BrowseItem extends DSpaceObject
{
/** Logger */
private static Logger log = Logger.getLogger(BrowseItem.class);
/** DSpace context */
private Context context;
/** a List of all the metadata */
private List metadata = new ArrayList();
/** database id of the item */
private int id = -1;
/** is the item in the archive */
private boolean in_archive = true;
/** is the item withdrawn */
private boolean withdrawn = false;
/** item handle */
private String handle = null;
/** inner item, if we really absolutely have to instantiate it */
private Item item;
/**
* Construct a new browse item with the given context and the database id
*
* @param context the DSpace context
* @param id the database id of the item
* @param in_archive
* @param withdrawn
*/
public BrowseItem(Context context, int id, boolean in_archive, boolean withdrawn)
{
this.context = context;
this.id = id;
this.in_archive = in_archive;
this.withdrawn = withdrawn;
}
/**
* Get String array of metadata values matching the given parameters
*
* @param schema metadata schema
* @param element metadata element
* @param qualifier metadata qualifier
* @param lang metadata language
* @return array of matching values
* @throws SQLException
*/
public DCValue[] getMetadata(String schema, String element, String qualifier, String lang)
throws SQLException
{
try
{
BrowseItemDAO dao = BrowseDAOFactory.getItemInstance(context);
// if the qualifier is a wildcard, we have to get it out of the
// database
if (Item.ANY.equals(qualifier))
{
return dao.queryMetadata(id, schema, element, qualifier, lang);
}
if (!metadata.isEmpty())
{
List values = new ArrayList();
Iterator i = metadata.iterator();
while (i.hasNext())
{
DCValue dcv = (DCValue) i.next();
if (match(schema, element, qualifier, lang, dcv))
{
values.add(dcv);
}
}
if (values.isEmpty())
{
DCValue[] dcvs = dao.queryMetadata(id, schema, element, qualifier, lang);
if (dcvs != null)
{
Collections.addAll(metadata, dcvs);
}
return dcvs;
}
// else, Create an array of matching values
DCValue[] valueArray = new DCValue[values.size()];
valueArray = (DCValue[]) values.toArray(valueArray);
return valueArray;
}
else
{
DCValue[] dcvs = dao.queryMetadata(id, schema, element, qualifier, lang);
if (dcvs != null)
{
Collections.addAll(metadata, dcvs);
}
return dcvs;
}
}
catch (BrowseException be)
{
log.error("caught exception: ", be);
return null;
}
}
/**
* Get the type of object. This object masquerates as an Item, so this
* returns the value of Constants.ITEM
*
*@return Constants.ITEM
*/
public int getType()
{
return Constants.ITEM;
}
/**
* @deprecated
* @param real
* @return
*/
public int getType(boolean real)
{
if (!real)
{
return Constants.ITEM;
}
else
{
return getType();
}
}
/**
* get the database id of the item
*
* @return database id of item
*/
public int getID()
{
return id;
}
/**
* Set the database id of the item
*
* @param id the database id of the item
*/
public void setID(int id)
{
this.id = id;
}
/**
* Utility method for pattern-matching metadata elements. This
* method will return <code>true</code> if the given schema,
* element, qualifier and language match the schema, element,
* qualifier and language of the <code>DCValue</code> object passed
* in. Any or all of the elemenent, qualifier and language passed
* in can be the <code>Item.ANY</code> wildcard.
*
* @param schema
* the schema for the metadata field. <em>Must</em> match
* the <code>name</code> of an existing metadata schema.
* @param element
* the element to match, or <code>Item.ANY</code>
* @param qualifier
* the qualifier to match, or <code>Item.ANY</code>
* @param language
* the language to match, or <code>Item.ANY</code>
* @param dcv
* the Dublin Core value
* @return <code>true</code> if there is a match
*/
private boolean match(String schema, String element, String qualifier,
String language, DCValue dcv)
{
// We will attempt to disprove a match - if we can't we have a match
if (!element.equals(Item.ANY) && !element.equals(dcv.element))
{
// Elements do not match, no wildcard
return false;
}
if (qualifier == null)
{
// Value must be unqualified
if (dcv.qualifier != null)
{
// Value is qualified, so no match
return false;
}
}
else if (!qualifier.equals(Item.ANY))
{
// Not a wildcard, so qualifier must match exactly
if (!qualifier.equals(dcv.qualifier))
{
return false;
}
}
if (language == null)
{
// Value must be null language to match
if (dcv.language != null)
{
// Value is qualified, so no match
return false;
}
}
else if (!language.equals(Item.ANY))
{
// Not a wildcard, so language must match exactly
if (!language.equals(dcv.language))
{
return false;
}
}
else if (!schema.equals(Item.ANY))
{
if (dcv.schema != null && !dcv.schema.equals(schema))
{
// The namespace doesn't match
return false;
}
}
// If we get this far, we have a match
return true;
}
/* (non-Javadoc)
* @see org.dspace.content.DSpaceObject#getHandle()
*/
public String getHandle()
{
// Get our Handle if any
if (this.handle == null)
{
try
{
this.handle = HandleManager.findHandle(context, this);
}
catch (SQLException e)
{
log.error("caught exception: ", e);
}
}
return this.handle;
}
/**
* Get a thumbnail object out of the item.
*
* Warning: using this method actually instantiates an Item, which has a
* corresponding performance hit on the database during browse listing
* rendering. That's your own fault for wanting to put images on your
* browse page!
*
* @return
* @throws SQLException
*/
public Thumbnail getThumbnail()
throws SQLException
{
// instantiate an item for this one. Not nice.
item = Item.find(context, id);
if (item == null)
{
return null;
}
// now go sort out the thumbnail
// if there's no original, there is no thumbnail
Bundle[] original = item.getBundles("ORIGINAL");
if (original.length == 0)
{
return null;
}
// if multiple bitstreams, check if the primary one is HTML
boolean html = false;
if (original[0].getBitstreams().length > 1)
{
Bitstream[] bitstreams = original[0].getBitstreams();
for (int i = 0; (i < bitstreams.length) && !html; i++)
{
if (bitstreams[i].getID() == original[0].getPrimaryBitstreamID())
{
html = bitstreams[i].getFormat().getMIMEType().equals("text/html");
}
}
}
// now actually pull out the thumbnail (ouch!)
Bundle[] thumbs = item.getBundles("THUMBNAIL");
// if there are thumbs and we're not dealing with an HTML item
// then show the thumbnail
if ((thumbs.length > 0) && !html)
{
Bitstream thumbnailBitstream;
Bitstream originalBitstream;
if ((original[0].getBitstreams().length > 1) && (original[0].getPrimaryBitstreamID() > -1))
{
originalBitstream = Bitstream.find(context, original[0].getPrimaryBitstreamID());
thumbnailBitstream = thumbs[0].getBitstreamByName(originalBitstream.getName() + ".jpg");
}
else
{
originalBitstream = original[0].getBitstreams()[0];
thumbnailBitstream = thumbs[0].getBitstreams()[0];
}
if ((thumbnailBitstream != null)
&& (AuthorizeManager.authorizeActionBoolean(context, thumbnailBitstream, Constants.READ)))
{
Thumbnail thumbnail = new Thumbnail(thumbnailBitstream, originalBitstream);
return thumbnail;
}
}
return null;
}
public String getName()
{
// FIXME: there is an exception handling problem here
try
{
DCValue t[] = getMetadata("dc", "title", null, Item.ANY);
return (t.length >= 1) ? t[0].value : null;
}
catch (SQLException sqle)
{
log.error("caught exception: ", sqle);
return null;
}
}
public boolean isArchived()
{
return in_archive;
}
public boolean isWithdrawn()
{
return withdrawn;
}
}

View File

@@ -0,0 +1,73 @@
/*
* BrowseItemDAO.java
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
import org.dspace.content.DCValue;
import java.sql.SQLException;
public interface BrowseItemDAO
{
/**
* Get an array of all the items in the database
*
* @return array of items
* @throws java.sql.SQLException
*/
public BrowseItem[] findAll()
throws SQLException;
/**
* perform a database query to obtain the string array of values corresponding to
* the passed parameters. In general you should use:
*
* <code>
* getMetadata(schema, element, qualifier, lang);
* </code>
*
* As this will obtain the value from cache if available first.
*
* @param itemId
* @param schema
* @param element
* @param qualifier
* @param lang
* @return
* @throws SQLException
*/
public DCValue[] queryMetadata(int itemId, String schema, String element, String qualifier, String lang)
throws SQLException;
}

View File

@@ -0,0 +1,165 @@
/*
* BrowseItemDAOOracle.java
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
import org.dspace.storage.rdbms.TableRowIterator;
import org.dspace.storage.rdbms.DatabaseManager;
import org.dspace.storage.rdbms.TableRow;
import org.dspace.core.Context;
import org.dspace.content.DCValue;
import org.dspace.content.Item;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
public class BrowseItemDAOOracle implements BrowseItemDAO
{
/** query to obtain all the items from the database */
private String findAll = "SELECT item_id, in_archive, withdrawn FROM item WHERE in_archive = 1 OR withdrawn = 1";
/** query to get the text value of a metadata element only (qualifier is NULL) */
private String getByMetadataElement = "SELECT text_value,text_lang,element,qualifier FROM metadatavalue, metadatafieldregistry, metadataschemaregistry " +
"WHERE metadatavalue.item_id = ? " +
" AND metadatavalue.metadata_field_id = metadatafieldregistry.metadata_field_id " +
" AND metadatafieldregistry.element = ? " +
" AND metadatafieldregistry.qualifier IS NULL " +
" AND metadatafieldregistry.metadata_schema_id=metadataschemaregistry.metadata_schema_id " +
" AND metadataschemaregistry.short_id = ?";
/** query to get the text value of a metadata element and qualifier */
private String getByMetadata = "SELECT text_value,text_lang,element,qualifier FROM metadatavalue, metadatafieldregistry, metadataschemaregistry " +
"WHERE metadatavalue.item_id = ? " +
" AND metadatavalue.metadata_field_id = metadatafieldregistry.metadata_field_id " +
" AND metadatafieldregistry.element = ? " +
" AND metadatafieldregistry.qualifier = ? " +
" AND metadatafieldregistry.metadata_schema_id=metadataschemaregistry.metadata_schema_id " +
" AND metadataschemaregistry.short_id = ?";
/** query to get the text value of a metadata element with the wildcard qualifier (*) */
private String getByMetadataAnyQualifier = "SELECT text_value,text_lang,element,qualifier FROM metadatavalue, metadatafieldregistry, metadataschemaregistry " +
"WHERE metadatavalue.item_id = ? " +
" AND metadatavalue.metadata_field_id = metadatafieldregistry.metadata_field_id " +
" AND metadatafieldregistry.element = ? " +
" AND metadatafieldregistry.metadata_schema_id=metadataschemaregistry.metadata_schema_id " +
" AND metadataschemaregistry.short_id = ?";
/** DSpace context */
private Context context;
public BrowseItemDAOOracle(Context context)
throws BrowseException
{
this.context = context;
}
public BrowseItem[] findAll() throws SQLException
{
TableRowIterator tri = null;
List<BrowseItem> items = new ArrayList<BrowseItem>();
try
{
tri = DatabaseManager.query(context, findAll);
while (tri.hasNext())
{
TableRow row = tri.next();
items.add(new BrowseItem(context, row.getIntColumn("item_id"),
row.getBooleanColumn("in_archive"),
row.getBooleanColumn("withdrawn")));
}
}
finally
{
if (tri != null)
tri.close();
}
BrowseItem[] bis = new BrowseItem[items.size()];
return items.toArray(bis);
}
public DCValue[] queryMetadata(int itemId, String schema, String element, String qualifier, String lang)
throws SQLException
{
List<DCValue> values = new ArrayList<DCValue>();
TableRowIterator tri = null;
try
{
if (qualifier == null)
{
Object[] params = { new Integer(itemId), element, schema };
tri = DatabaseManager.query(context, getByMetadataElement, params);
}
else if (Item.ANY.equals(qualifier))
{
Object[] params = { new Integer(itemId), element, schema };
tri = DatabaseManager.query(context, getByMetadataAnyQualifier, params);
}
else
{
Object[] params = { new Integer(itemId), element, qualifier, schema };
tri = DatabaseManager.query(context, getByMetadata, params);
}
if (!tri.hasNext())
{
return new DCValue[0];
}
while (tri.hasNext())
{
TableRow tr = tri.next();
DCValue dcv = new DCValue();
dcv.schema = schema;
dcv.element = tr.getStringColumn("element");
dcv.qualifier = tr.getStringColumn("qualifier");
dcv.language = tr.getStringColumn("text_lang");
dcv.value = tr.getStringColumn("text_value");
values.add(dcv);
}
}
finally
{
if (tri != null)
tri.close();
}
DCValue[] dcvs = new DCValue[values.size()];
return values.toArray(dcvs);
}
}

View File

@@ -0,0 +1,165 @@
/*
* BrowseItemDAOPostgres.java
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
import org.dspace.storage.rdbms.TableRowIterator;
import org.dspace.storage.rdbms.DatabaseManager;
import org.dspace.storage.rdbms.TableRow;
import org.dspace.core.Context;
import org.dspace.content.DCValue;
import org.dspace.content.Item;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
public class BrowseItemDAOPostgres implements BrowseItemDAO
{
/** query to obtain all the items from the database */
private String findAll = "SELECT item_id, in_archive, withdrawn FROM item WHERE in_archive = true OR withdrawn = true";
/** query to get the text value of a metadata element only (qualifier is NULL) */
private String getByMetadataElement = "SELECT text_value,text_lang,element,qualifier FROM metadatavalue, metadatafieldregistry, metadataschemaregistry " +
"WHERE metadatavalue.item_id = ? " +
" AND metadatavalue.metadata_field_id = metadatafieldregistry.metadata_field_id " +
" AND metadatafieldregistry.element = ? " +
" AND metadatafieldregistry.qualifier IS NULL " +
" AND metadatafieldregistry.metadata_schema_id=metadataschemaregistry.metadata_schema_id " +
" AND metadataschemaregistry.short_id = ?";
/** query to get the text value of a metadata element and qualifier */
private String getByMetadata = "SELECT text_value,text_lang,element,qualifier FROM metadatavalue, metadatafieldregistry, metadataschemaregistry " +
"WHERE metadatavalue.item_id = ? " +
" AND metadatavalue.metadata_field_id = metadatafieldregistry.metadata_field_id " +
" AND metadatafieldregistry.element = ? " +
" AND metadatafieldregistry.qualifier = ? " +
" AND metadatafieldregistry.metadata_schema_id=metadataschemaregistry.metadata_schema_id " +
" AND metadataschemaregistry.short_id = ?";
/** query to get the text value of a metadata element with the wildcard qualifier (*) */
private String getByMetadataAnyQualifier = "SELECT text_value,text_lang,element,qualifier FROM metadatavalue, metadatafieldregistry, metadataschemaregistry " +
"WHERE metadatavalue.item_id = ? " +
" AND metadatavalue.metadata_field_id = metadatafieldregistry.metadata_field_id " +
" AND metadatafieldregistry.element = ? " +
" AND metadatafieldregistry.metadata_schema_id=metadataschemaregistry.metadata_schema_id " +
" AND metadataschemaregistry.short_id = ?";
/** DSpace context */
private Context context;
public BrowseItemDAOPostgres(Context context)
throws BrowseException
{
this.context = context;
}
public BrowseItem[] findAll() throws SQLException
{
TableRowIterator tri = null;
List<BrowseItem> items = new ArrayList<BrowseItem>();
try
{
tri = DatabaseManager.query(context, findAll);
while (tri.hasNext())
{
TableRow row = tri.next();
items.add(new BrowseItem(context, row.getIntColumn("item_id"),
row.getBooleanColumn("in_archive"),
row.getBooleanColumn("withdrawn")));
}
}
finally
{
if (tri != null)
tri.close();
}
BrowseItem[] bis = new BrowseItem[items.size()];
return items.toArray(bis);
}
public DCValue[] queryMetadata(int itemId, String schema, String element, String qualifier, String lang)
throws SQLException
{
List<DCValue> values = new ArrayList<DCValue>();
TableRowIterator tri = null;
try
{
if (qualifier == null)
{
Object[] params = { new Integer(itemId), element, schema };
tri = DatabaseManager.query(context, getByMetadataElement, params);
}
else if (Item.ANY.equals(qualifier))
{
Object[] params = { new Integer(itemId), element, schema };
tri = DatabaseManager.query(context, getByMetadataAnyQualifier, params);
}
else
{
Object[] params = { new Integer(itemId), element, qualifier, schema };
tri = DatabaseManager.query(context, getByMetadata, params);
}
if (!tri.hasNext())
{
return new DCValue[0];
}
while (tri.hasNext())
{
TableRow tr = tri.next();
DCValue dcv = new DCValue();
dcv.schema = schema;
dcv.element = tr.getStringColumn("element");
dcv.qualifier = tr.getStringColumn("qualifier");
dcv.language = tr.getStringColumn("text_lang");
dcv.value = tr.getStringColumn("text_value");
values.add(dcv);
}
}
finally
{
if (tri != null)
tri.close();
}
DCValue[] dcvs = new DCValue[values.size()];
return values.toArray(dcvs);
}
}

View File

@@ -0,0 +1,217 @@
/*
* BrowseOutput.java
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
/**
* Utility class to provide a wrapper for the various output possibilities from
* the IndexBrowse class. It can output to the screen and to file, and it can be
* verbose or not verbose.
*
* @author Richard Jones
*
*/
public class BrowseOutput
{
/** be verbose? */
private boolean verbose = false;
/** print to the screen? */
private boolean print = false;
/** write to file? */
private boolean file = false;
/** append to file, or overwrite? */
private boolean append = true;
/** name of file to write to */
private String fileName;
/**
* Constructor.
*/
public BrowseOutput()
{
}
/**
* @return Returns the append.
*/
public boolean isAppend()
{
return append;
}
/**
* @param append
* The append to set.
*/
public void setAppend(boolean append)
{
this.append = append;
}
/**
* @return Returns the fileName.
*/
public String getFileName()
{
return fileName;
}
/**
* @param fileName
* The fileName to set.
*/
public void setFileName(String fileName)
{
this.fileName = fileName;
setAppend(false);
}
/**
* @return Returns the file.
*/
public boolean isFile()
{
return file;
}
/**
* @param file
* The file to set.
*/
public void setFile(boolean file)
{
this.file = file;
}
/**
* @return Returns the print.
*/
public boolean isPrint()
{
return print;
}
/**
* @param print
* The print to set.
*/
public void setPrint(boolean print)
{
this.print = print;
}
/**
* @return Returns the verbose.
*/
public boolean isVerbose()
{
return verbose;
}
/**
* @param verbose
* The verbose to set.
*/
public void setVerbose(boolean verbose)
{
this.verbose = verbose;
}
/**
* Pass in a message to be processed. If the setting is verbose
* then this will be output to System.out
*
* @param message the message to set
*/
public void message(String message)
{
if (isVerbose())
{
System.out.println(message);
}
}
/**
* Pass in a message that must be displayed to the user, irrespective
* of the verbosity. Will be displayed to System.out
*
* @param message the urgent message
*/
public void urgent(String message)
{
System.out.println(message);
}
/**
* Pass in some SQL. If print is set to true this will output to the
* screen. If file is set to true, this will write to the file specified.
*
* @param sql
* @throws BrowseException
*/
public void sql(String sql) throws BrowseException
{
if (isPrint())
{
System.out.println(sql);
}
if (isFile())
{
try
{
BufferedWriter out = new BufferedWriter(new FileWriter(fileName, isAppend()));
out.write(sql + "\n");
out.close();
setAppend(true);
}
catch (IOException e)
{
throw new BrowseException(e);
}
}
}
}

View File

@@ -0,0 +1,648 @@
/*
* BrowserScope.java
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
import org.dspace.content.Collection;
import org.dspace.content.Community;
import org.dspace.content.DSpaceObject;
import org.dspace.core.Context;
import org.dspace.sort.SortOption;
import org.dspace.sort.SortException;
import org.apache.log4j.Logger;
/**
* A class which represents the initial request to the browse system.
* When passed into the BrowseEngine, this will cause the creation
* of a BrowseInfo object
*
* @author Richard Jones
*
*/
public class BrowserScope
{
/** the logger for this class */
private static Logger log = Logger.getLogger(BrowserScope.class);
/** the DSpace context */
private Context context;
/** the current browse index */
private BrowseIndex browseIndex;
/** the order in which to display results */
private String order;
/** the field upon which to sort */
private int sortBy;
/** the value to restrict the browse to */
private String filterValue;
/** exact or partial matching of the value */
private boolean filterValuePartial = false;
/** the language of the value to restrict the browse to */
private String filterValueLang;
/** the item id focus of the browse */
private int jumpItemId = -1;
/** the string value to start with */
private String startsWith;
/** the number of results per page to display */
private int resultsPerPage = 20;
/** the Collection to which to restrict */
private Collection collection;
/** the Community to which to restrict */
private Community community;
/** the sort option being used */
private SortOption sortOption;
/** the value upon which to focus */
private String jumpValue;
/** the language of the value upon which to focus */
private String jumpValueLang;
/** the browse level */
private int level = 0;
/** the number of authors to display in the results */
private int etAl = 0;
/** the number of items to offset into the result ie. 0 = 1st record */
private int offset = 0;
/**
* Construct a new BrowserScope using the given Context
*
* @param context the DSpace Context
*/
public BrowserScope(Context context)
{
this.context = context;
}
/**
* Set the DSpaceObject that is the container for this browse. If this
* is not of type Collection or Community, this method will throw an
* exception
*
* @param dso the container object; a Community or Collection
* @throws BrowseException
*/
public void setBrowseContainer(DSpaceObject dso)
throws BrowseException
{
if (dso instanceof Collection)
{
this.collection = (Collection) dso;
}
else if (dso instanceof Community)
{
this.community = (Community) dso;
}
else
{
throw new BrowseException("The container must be a community or a collection");
}
}
/**
* Obtain a DSpaceObject that represents the container object. This will be
* a Community or a Collection
*
* @return A DSpaceObject representing a Community or a Collection
*/
public DSpaceObject getBrowseContainer()
{
if (this.collection != null)
{
return this.collection;
}
if (this.community != null)
{
return this.community;
}
return null;
}
/**
* @param level the browse level
*/
public void setBrowseLevel(int level)
{
this.level = level;
}
/**
* @return the browse level
*/
public int getBrowseLevel()
{
return this.level;
}
/**
* @return true if top level browse, false if not
*/
public boolean isTopLevel()
{
if (this.level == 0)
{
return true;
}
return false;
}
/**
* @return true if second level browse, false if not
*/
public boolean isSecondLevel()
{
if (this.level == 1)
{
return true;
}
return false;
}
/**
* @return Returns the browseIndex.
*/
public BrowseIndex getBrowseIndex()
{
return browseIndex;
}
/**
* @param browseIndex The browseIndex to set.
*/
public void setBrowseIndex(BrowseIndex browseIndex)
throws BrowseException
{
this.browseIndex = browseIndex;
}
/**
* @return Returns the author limit.
*/
public int getEtAl()
{
return etAl;
}
/**
* @param etAl the author limit
*/
public void setEtAl(int etAl)
{
this.etAl = etAl;
}
/**
* @return Returns the collection.
*/
public Collection getCollection()
{
return collection;
}
/**
* @param collection The collection to set.
*/
public void setCollection(Collection collection)
{
this.collection = collection;
}
/**
* @return Returns the community.
*/
public Community getCommunity()
{
return community;
}
/**
* @param community The community to set.
*/
public void setCommunity(Community community)
{
this.community = community;
}
/**
* @return Returns the context.
*/
public Context getContext()
{
return context;
}
/**
* @param context The context to set.
*/
public void setContext(Context context)
{
this.context = context;
}
/**
* @return Returns the focus.
*/
public int getJumpToItem()
{
return jumpItemId;
}
/**
* @param itemId The focus to set.
*/
public void setJumpToItem(int itemId)
{
this.jumpItemId = itemId;
}
/**
* @return the value to focus on
*/
public String getJumpToValue()
{
return jumpValue;
}
/**
* @param value the value to focus on
*/
public void setJumpToValue(String value)
{
this.jumpValue = value;
}
/**
* @return the language of the value to focus on
*/
public String getJumpToValueLang()
{
return jumpValueLang;
}
/**
* @param valueLang the language of the value to focus on
*/
public void setJumpToValueLang(String valueLang)
{
this.jumpValueLang = valueLang;
}
/**
* @return Returns the order.
*/
public String getOrder()
{
if (order != null)
return order;
BrowseIndex bi = getBrowseIndex();
if (bi != null)
return bi.getDefaultOrder();
return SortOption.ASCENDING;
}
/**
* @param order The order to set.
*/
public void setOrder(String order)
{
if (order == null)
{
this.order = null;
}
else if (SortOption.ASCENDING.equalsIgnoreCase(order))
{
this.order = SortOption.ASCENDING;
}
else if (SortOption.DESCENDING.equalsIgnoreCase(order))
{
this.order = SortOption.DESCENDING;
}
}
/**
* @return Returns the resultsPerPage.
*/
public int getResultsPerPage()
{
return resultsPerPage;
}
/**
* @param resultsPerPage The resultsPerPage to set.
*/
public void setResultsPerPage(int resultsPerPage)
{
if (resultsPerPage > -1)
this.resultsPerPage = resultsPerPage;
}
/**
* @return Returns the sortBy.
*/
public int getSortBy()
{
return sortBy;
}
/**
* @param sortBy The sortBy to set.
*/
public void setSortBy(int sortBy)
throws BrowseException
{
this.sortBy = sortBy;
}
/**
* @return returns the offset for the browse
*/
public int getOffset()
{
return offset;
}
/**
* @param offset the offset to use for this scope
*/
public void setOffset(int offset)
{
this.offset = offset;
}
/**
* Obtain the sort option
*
* @return the sort option
* @throws BrowseException
*/
public SortOption getSortOption()
throws BrowseException
{
try
{
// If a sortOption hasn't been set, work out the default
if (sortOption == null)
{
// We need a browse index first though
if (browseIndex != null)
{
// If a sorting hasn't been specified, and it's a metadata browse
if (sortBy <= 0 && browseIndex.isMetadataIndex())
{
// Create a dummy sortOption for the metadata sort
String dataType = browseIndex.getDataType();
String type = ("date".equals(dataType) ? "date" : "text");
sortOption = new SortOption(0, browseIndex.getName(), browseIndex.getMetadata(0), type);
}
else
{
// If a sorting hasn't been specified
if (sortBy <= 0)
{
// Get the sort option from the index
sortOption = browseIndex.getSortOption();
if (sortOption == null)
{
// No sort option, so default to the first one defined in the config
for (SortOption so : SortOption.getSortOptions())
{
sortOption = so;
break;
}
}
}
else
{
// A sorting has been specified, so get it from the configured sort columns
for (SortOption so : SortOption.getSortOptions())
{
if (so.getNumber() == sortBy)
sortOption = so;
}
}
}
}
}
return sortOption;
}
catch (SortException se)
{
throw new BrowseException("Error in SortOptions", se);
}
}
/**
* @return Returns the startsWith.
*/
public String getStartsWith()
{
return startsWith;
}
/**
* @param startsWith The startsWith to set.
*/
public void setStartsWith(String startsWith)
{
this.startsWith = startsWith;
}
/**
* Used for second-level item browses,
* to only display items that match the value
* @return Returns the value.
*/
public String getFilterValue()
{
return filterValue;
}
/**
* Used for second-level item browses,
* to only display items that match the value
* @param value The value to set.
*/
public void setFilterValue(String value)
{
this.filterValue = value;
}
/**
* Should the filter value be treated as partial, or exact
* @return true if partial, false if exact
*/
public boolean getFilterValuePartial()
{
return filterValuePartial;
}
/**
* Should the filter value be treated as partial, or exact
* @param filterValuePartial true if partial, false if exact
*/
public void setFilterValuePartial(boolean filterValuePartial)
{
this.filterValuePartial = filterValuePartial;
}
/**
* @return Returns the language.
*/
public String getFilterValueLang()
{
return filterValueLang;
}
/**
* @param lang The language to set.
*/
public void setFilterValueLang(String lang)
{
this.filterValueLang = lang;
}
/**
* @return true if in community, false if not
*/
public boolean inCommunity()
{
if (this.community != null)
{
return true;
}
return false;
}
/**
* @return true if in collection, false if not
*/
public boolean inCollection()
{
if (this.collection != null)
{
return true;
}
return false;
}
/**
* @return true if ascending, false if not - or not set
*/
public boolean isAscending()
{
if (SortOption.ASCENDING.equalsIgnoreCase(order))
{
return true;
}
if (SortOption.DESCENDING.equalsIgnoreCase(order))
{
return false;
}
BrowseIndex bi = getBrowseIndex();
if (bi != null && SortOption.DESCENDING.equalsIgnoreCase(bi.getDefaultOrder()))
return false;
return true;
}
/**
* @return true if has value, false if not
*/
public boolean hasFilterValue()
{
if (filterValue == null || "".equals(filterValue))
{
return false;
}
return true;
}
/**
* @return true if has item focus, false if not
*/
public boolean hasJumpToItem()
{
if (jumpItemId == -1)
{
return false;
}
return true;
}
/**
* @return true if has value focus, false if not
*/
public boolean hasJumpToValue()
{
if (this.jumpValue != null)
{
return true;
}
return false;
}
/**
* @return true if has starts with value, false if not
*/
public boolean hasStartsWith()
{
if (this.startsWith != null)
{
return true;
}
return false;
}
}

View File

@@ -0,0 +1,108 @@
/*
* CrossLinks.java
*
* Version: $Revision: 1.9 $
*
* Date: $Date: 2005/04/20 14:23:12 $
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
import java.util.HashMap;
import org.dspace.core.ConfigurationManager;
/**
* Class to represent the configuration of the cross-linking between browse
* pages (for example, between the author name in one full listing to the
* author's list of publications).
*
* @author Richard Jones
*
*/
public class CrossLinks
{
/** a map of the desired links */
private HashMap links = new HashMap();
/**
* Construct a new object which will obtain the configuration for itself
*
* @throws BrowseException
*/
public CrossLinks()
throws BrowseException
{
int i = 1;
while (true)
{
String field = "webui.browse.link." + i;
String config = ConfigurationManager.getProperty(field);
if (config == null)
{
break;
}
String[] parts = config.split(":");
if (parts.length != 2)
{
throw new BrowseException("Invalid configuration for " + field + ": " + config);
}
links.put(parts[1], parts[0]);
i++;
}
}
/**
* Is there a link for the given canonical form of metadata (i.e. schema.element.qualifier)
*
* @param metadata the metadata to check for a link on
* @return
*/
public boolean hasLink(String metadata)
{
return links.containsKey(metadata);
}
/**
* get the type of link that the bit of metadata has
*
* @param metadata the metadata to get the link type for
* @return
*/
public String getLinkType(String metadata)
{
return (String) links.get(metadata);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,98 @@
/*
* ItemCountDAO.java
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
import org.dspace.content.Community;
import org.dspace.content.Collection;
import org.dspace.core.Context;
import org.dspace.content.DSpaceObject;
/**
* Interface for data access of cached community and collection item count
* information
*
* @author Richard Jones
*
*/
public interface ItemCountDAO
{
/**
* Set the DSpace Context to use during data access
*
* @param context
* @throws ItemCountException
*/
public void setContext(Context context) throws ItemCountException;
/**
* Set the given count as the number of items in the given community
*
* @param community
* @param count
* @throws ItemCountException
*/
public void communityCount(Community community, int count) throws ItemCountException;
/**
* Set the given count as the number of items in the given collection
*
* @param collection
* @param count
* @throws ItemCountException
*/
public void collectionCount(Collection collection, int count) throws ItemCountException;
/**
* Get the number of items in the given DSpaceObject container. This method will
* only succeed if the DSpaceObject is an instance of either a Community or a
* Collection. Otherwise it will throw an exception
*
* @param dso
* @return
* @throws ItemCountException
*/
public int getCount(DSpaceObject dso) throws ItemCountException;
/**
* Remove any cached data regarding the given DSpaceObject container. This method will
* only succeed if the DSpaceObject is an instance of either a Community or a
* Collection. Otherwise it will throw an exception
*
* @param dso
* @throws ItemCountException
*/
public void remove(DSpaceObject dso) throws ItemCountException;
}

View File

@@ -0,0 +1,79 @@
/*
* ItemCountDAOFactory.java
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
import org.dspace.core.Context;
import org.dspace.core.ConfigurationManager;
/**
* Factory class to allow us to load the correct DAO for registering
* item count information
*
* @author Richard Jones
*
*/
public class ItemCountDAOFactory
{
/**
* Get an instance of ItemCountDAO which supports the correct database
* for the specific DSpace instance.
*
* @param context
* @return
* @throws ItemCountException
*/
public static ItemCountDAO getInstance(Context context)
throws ItemCountException
{
String db = ConfigurationManager.getProperty("db.name");
ItemCountDAO dao;
if ("postgres".equals(db))
{
dao = new ItemCountDAOPostgres();
}
else if ("oracle".equals(db))
{
dao = new ItemCountDAOOracle();
}
else
{
throw new ItemCountException("Database type: " + db + " is not currently supported");
}
dao.setContext(context);
return dao;
}
}

View File

@@ -0,0 +1,336 @@
/*
* ItemCountDAOOracle.java
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
import org.apache.log4j.Logger;
import org.dspace.content.Collection;
import org.dspace.content.Community;
import org.dspace.content.DSpaceObject;
import org.dspace.core.Context;
import org.dspace.storage.rdbms.TableRowIterator;
import org.dspace.storage.rdbms.TableRow;
import org.dspace.storage.rdbms.DatabaseManager;
import java.sql.SQLException;
/**
* Oracle driver implementing ItemCountDAO interface to cache item
* count information in communities and collections
*
* @author Richard Jones
*
*/
public class ItemCountDAOOracle implements ItemCountDAO
{
/** Log4j logger */
private static Logger log = Logger.getLogger(ItemCountDAOOracle.class);
/** DSpace context */
private Context context;
/** SQL to select on a collection id */
private String collectionSelect = "SELECT * FROM collection_item_count WHERE collection_id = ?";
/** SQL to insert a new collection record */
private String collectionInsert = "INSERT INTO collection_item_count (collection_id, count) VALUES (?, ?)";
/** SQL to update an existing collection record */
private String collectionUpdate = "UPDATE collection_item_count SET count = ? WHERE collection_id = ?";
/** SQL to remove a collection record */
private String collectionRemove = "DELETE FROM collection_item_count WHERE collection_id = ?";
/** SQL to select on a community id */
private String communitySelect = "SELECT * FROM community_item_count WHERE community_id = ?";
/** SQL to insert a new community record */
private String communityInsert = "INSERT INTO community_item_count (community_id, count) VALUES (?, ?)";
/** SQL to update an existing community record */
private String communityUpdate = "UPDATE community_item_count SET count = ? WHERE community_id = ?";
/** SQL to remove a community record */
private String communityRemove = "DELETE FROM community_item_count WHERE community_id = ?";
/**
* Store the count of the given collection
*
* @param collection
* @param count
* @throws ItemCountException
*/
public void collectionCount(Collection collection, int count)
throws ItemCountException
{
try
{
// first find out if we have a record
Object[] sparams = { new Integer(collection.getID()) };
TableRowIterator tri = DatabaseManager.query(context, collectionSelect, sparams);
if (tri.hasNext())
{
Object[] params = { new Integer(count), new Integer(collection.getID()) };
DatabaseManager.updateQuery(context, collectionUpdate, params);
}
else
{
Object[] params = { new Integer(collection.getID()), new Integer(count) };
DatabaseManager.updateQuery(context, collectionInsert, params);
}
tri.close();
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
}
/**
* Store the count of the given community
*
* @param community
* @param count
* @throws ItemCountException
*/
public void communityCount(Community community, int count)
throws ItemCountException
{
try
{
// first find out if we have a record
Object[] sparams = { new Integer(community.getID()) };
TableRowIterator tri = DatabaseManager.query(context, communitySelect, sparams);
if (tri.hasNext())
{
Object[] params = { new Integer(count), new Integer(community.getID()) };
DatabaseManager.updateQuery(context, communityUpdate, params);
}
else
{
Object[] params = { new Integer(community.getID()), new Integer(count) };
DatabaseManager.updateQuery(context, communityInsert, params);
}
tri.close();
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
}
/**
* Set the dspace context to use
*
* @param context
* @throws ItemCountException
*/
public void setContext(Context context)
throws ItemCountException
{
this.context = context;
}
/**
* get the count of the items in the given container
*
* @param dso
* @return
* @throws ItemCountException
*/
public int getCount(DSpaceObject dso)
throws ItemCountException
{
if (dso instanceof Collection)
{
return getCollectionCount((Collection) dso);
}
else if (dso instanceof Community)
{
return getCommunityCount((Community) dso);
}
else
{
throw new ItemCountException("We can only count items in Communities or Collections");
}
}
/**
* remove the cache for the given container
*
* @param dso
* @throws ItemCountException
*/
public void remove(DSpaceObject dso) throws ItemCountException
{
if (dso instanceof Collection)
{
removeCollection((Collection) dso);
}
else if (dso instanceof Community)
{
removeCommunity((Community) dso);
}
else
{
throw new ItemCountException("We can only delete count of items from Communities or Collections");
}
}
/**
* remove the cache for the given collection
*
* @param collection
* @throws ItemCountException
*/
private void removeCollection(Collection collection)
throws ItemCountException
{
try
{
Object[] params = { new Integer(collection.getID()) };
DatabaseManager.updateQuery(context, collectionRemove, params);
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
}
/**
* Remove the cache for the given community
*
* @param community
* @throws ItemCountException
*/
private void removeCommunity(Community community)
throws ItemCountException
{
try
{
Object[] params = { new Integer(community.getID()) };
DatabaseManager.updateQuery(context, communityRemove, params);
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
}
/**
* Get the count for the given collection
*
* @param collection
* @return
* @throws ItemCountException
*/
private int getCollectionCount(Collection collection)
throws ItemCountException
{
try
{
Object[] params = { new Integer(collection.getID()) };
TableRowIterator tri = DatabaseManager.query(context, collectionSelect, params);
if (!tri.hasNext())
{
return 0;
}
TableRow tr = tri.next();
if (tri.hasNext())
{
throw new ItemCountException("More than one count row in the database");
}
tri.close();
return tr.getIntColumn("count");
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
}
/**
* get the count for the given community
*
* @param community
* @return
* @throws ItemCountException
*/
private int getCommunityCount(Community community)
throws ItemCountException
{
try
{
Object[] params = { new Integer(community.getID()) };
TableRowIterator tri = DatabaseManager.query(context, communitySelect, params);
if (!tri.hasNext())
{
return 0;
}
TableRow tr = tri.next();
if (tri.hasNext())
{
throw new ItemCountException("More than one count row in the database");
}
tri.close();
return tr.getIntColumn("count");
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
}
}

View File

@@ -0,0 +1,336 @@
/*
* ItemCountDAOPostgres.java
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
import org.apache.log4j.Logger;
import org.dspace.content.Collection;
import org.dspace.content.Community;
import org.dspace.content.DSpaceObject;
import org.dspace.core.Context;
import org.dspace.storage.rdbms.TableRowIterator;
import org.dspace.storage.rdbms.TableRow;
import org.dspace.storage.rdbms.DatabaseManager;
import java.sql.SQLException;
/**
* Postgres driver implementing ItemCountDAO interface to cache item
* count information in communities and collections
*
* @author Richard Jones
*
*/
public class ItemCountDAOPostgres implements ItemCountDAO
{
/** Log4j logger */
private static Logger log = Logger.getLogger(ItemCountDAOPostgres.class);
/** DSpace context */
private Context context;
/** SQL to select on a collection id */
private String collectionSelect = "SELECT * FROM collection_item_count WHERE collection_id = ?";
/** SQL to insert a new collection record */
private String collectionInsert = "INSERT INTO collection_item_count (collection_id, count) VALUES (?, ?)";
/** SQL to update an existing collection record */
private String collectionUpdate = "UPDATE collection_item_count SET count = ? WHERE collection_id = ?";
/** SQL to remove a collection record */
private String collectionRemove = "DELETE FROM collection_item_count WHERE collection_id = ?";
/** SQL to select on a community id */
private String communitySelect = "SELECT * FROM community_item_count WHERE community_id = ?";
/** SQL to insert a new community record */
private String communityInsert = "INSERT INTO community_item_count (community_id, count) VALUES (?, ?)";
/** SQL to update an existing community record */
private String communityUpdate = "UPDATE community_item_count SET count = ? WHERE community_id = ?";
/** SQL to remove a community record */
private String communityRemove = "DELETE FROM community_item_count WHERE community_id = ?";
/**
* Store the count of the given collection
*
* @param collection
* @param count
* @throws ItemCountException
*/
public void collectionCount(Collection collection, int count)
throws ItemCountException
{
try
{
// first find out if we have a record
Object[] sparams = { new Integer(collection.getID()) };
TableRowIterator tri = DatabaseManager.query(context, collectionSelect, sparams);
if (tri.hasNext())
{
Object[] params = { new Integer(count), new Integer(collection.getID()) };
DatabaseManager.updateQuery(context, collectionUpdate, params);
}
else
{
Object[] params = { new Integer(collection.getID()), new Integer(count) };
DatabaseManager.updateQuery(context, collectionInsert, params);
}
tri.close();
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
}
/**
* Store the count of the given community
*
* @param community
* @param count
* @throws ItemCountException
*/
public void communityCount(Community community, int count)
throws ItemCountException
{
try
{
// first find out if we have a record
Object[] sparams = { new Integer(community.getID()) };
TableRowIterator tri = DatabaseManager.query(context, communitySelect, sparams);
if (tri.hasNext())
{
Object[] params = { new Integer(count), new Integer(community.getID()) };
DatabaseManager.updateQuery(context, communityUpdate, params);
}
else
{
Object[] params = { new Integer(community.getID()), new Integer(count) };
DatabaseManager.updateQuery(context, communityInsert, params);
}
tri.close();
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
}
/**
* Set the dspace context to use
*
* @param context
* @throws ItemCountException
*/
public void setContext(Context context)
throws ItemCountException
{
this.context = context;
}
/**
* get the count of the items in the given container
*
* @param dso
* @return
* @throws ItemCountException
*/
public int getCount(DSpaceObject dso)
throws ItemCountException
{
if (dso instanceof Collection)
{
return getCollectionCount((Collection) dso);
}
else if (dso instanceof Community)
{
return getCommunityCount((Community) dso);
}
else
{
throw new ItemCountException("We can only count items in Communities or Collections");
}
}
/**
* remove the cache for the given container
*
* @param dso
* @throws ItemCountException
*/
public void remove(DSpaceObject dso) throws ItemCountException
{
if (dso instanceof Collection)
{
removeCollection((Collection) dso);
}
else if (dso instanceof Community)
{
removeCommunity((Community) dso);
}
else
{
throw new ItemCountException("We can only delete count of items from Communities or Collections");
}
}
/**
* remove the cache for the given collection
*
* @param collection
* @throws ItemCountException
*/
private void removeCollection(Collection collection)
throws ItemCountException
{
try
{
Object[] params = { new Integer(collection.getID()) };
DatabaseManager.updateQuery(context, collectionRemove, params);
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
}
/**
* Remove the cache for the given community
*
* @param community
* @throws ItemCountException
*/
private void removeCommunity(Community community)
throws ItemCountException
{
try
{
Object[] params = { new Integer(community.getID()) };
DatabaseManager.updateQuery(context, communityRemove, params);
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
}
/**
* Get the count for the given collection
*
* @param collection
* @return
* @throws ItemCountException
*/
private int getCollectionCount(Collection collection)
throws ItemCountException
{
try
{
Object[] params = { new Integer(collection.getID()) };
TableRowIterator tri = DatabaseManager.query(context, collectionSelect, params);
if (!tri.hasNext())
{
return 0;
}
TableRow tr = tri.next();
if (tri.hasNext())
{
throw new ItemCountException("More than one count row in the database");
}
tri.close();
return tr.getIntColumn("count");
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
}
/**
* get the count for the given community
*
* @param community
* @return
* @throws ItemCountException
*/
private int getCommunityCount(Community community)
throws ItemCountException
{
try
{
Object[] params = { new Integer(community.getID()) };
TableRowIterator tri = DatabaseManager.query(context, communitySelect, params);
if (!tri.hasNext())
{
return 0;
}
TableRow tr = tri.next();
if (tri.hasNext())
{
throw new ItemCountException("More than one count row in the database");
}
tri.close();
return tr.getIntColumn("count");
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
}
}

View File

@@ -0,0 +1,66 @@
/*
* ItemCountException.java
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
/**
* Exception type to handle item count specific problems
*
* @author Richard Jones
*
*/
public class ItemCountException extends Exception
{
public ItemCountException()
{
}
public ItemCountException(String message)
{
super(message);
}
public ItemCountException(Throwable cause)
{
super(cause);
}
public ItemCountException(String message, Throwable cause)
{
super(message, cause);
}
}

View File

@@ -0,0 +1,247 @@
/*
* ItemCounter.java
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
import org.apache.log4j.Logger;
import org.dspace.content.Community;
import org.dspace.content.Collection;
import org.dspace.core.Context;
import org.dspace.content.DSpaceObject;
import org.dspace.core.ConfigurationManager;
import java.sql.SQLException;
/**
* This class provides a standard interface to all item counting
* operations for communities and collections. It can be run from the
* command line to prepare the cached data if desired, simply by
* running:
*
* java org.dspace.browse.ItemCounter
*
* It can also be invoked via its standard API. In the event that
* the data cache is not being used, this class will return direct
* real time counts of content.
*
* @author Richard Jones
*
*/
public class ItemCounter
{
/** Log4j logger */
private static Logger log = Logger.getLogger(ItemCounter.class);
/** DAO to use to store and retrieve data */
private ItemCountDAO dao;
/** DSpace Context */
private Context context;
/**
* method invoked by CLI which will result in the number of items
* in each community and collection being cached. These counts will
* not update themselves until this is run again.
*
* @param args
*/
public static void main(String[] args)
throws ItemCountException, SQLException
{
Context context = new Context();
ItemCounter ic = new ItemCounter(context);
ic.buildItemCounts();
context.complete();
}
/**
* Construct a new item counter which will use the give DSpace Context
*
* @param context
* @throws ItemCountException
*/
public ItemCounter(Context context)
throws ItemCountException
{
this.context = context;
this.dao = ItemCountDAOFactory.getInstance(this.context);
}
/**
* This method does the grunt work of drilling through and iterating
* over all of the communities and collections in the system and
* obtaining and caching the item counts for each one.
*
* @throws ItemCountException
*/
public void buildItemCounts()
throws ItemCountException
{
try
{
Community[] tlc = Community.findAllTop(context);
for (int i = 0; i < tlc.length; i++)
{
count(tlc[i]);
}
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
}
/**
* Get the count of the items in the given container. If the configuration
* value webui.strengths.cache is equal to 'true' this will return the
* cached value if it exists. If it is equal to 'false' it will count
* the number of items in the container in real time
*
* @param dso
* @return
* @throws ItemCountException
* @throws SQLException
*/
public int getCount(DSpaceObject dso)
throws ItemCountException
{
boolean useCache = ConfigurationManager.getBooleanProperty("webui.strengths.cache");
if (useCache)
{
return dao.getCount(dso);
}
// if we make it this far, we need to manually count
if (dso instanceof Collection)
{
try {
return ((Collection) dso).countItems();
} catch (SQLException e) {
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
}
if (dso instanceof Community)
{
try {
return ((Community) dso).countItems();
} catch (SQLException e) {
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
}
return 0;
}
/**
* Remove any cached data for the given container
*
* @param dso
* @throws ItemCountException
*/
public void remove(DSpaceObject dso)
throws ItemCountException
{
dao.remove(dso);
}
/**
* count and cache the number of items in the community. This
* will include all sub-communities and collections in the
* community. It will also recurse into sub-communities and
* collections and call count() on them also.
*
* Therefore, the count the contents of the entire system, it is
* necessary just to call this method on each top level community
*
* @param community
* @throws ItemCountException
*/
private void count(Community community)
throws ItemCountException
{
try
{
// first count the community we are in
int count = community.countItems();
dao.communityCount(community, count);
// now get the sub-communities
Community[] scs = community.getSubcommunities();
for (int i = 0; i < scs.length; i++)
{
count(scs[i]);
}
// now get the collections
Collection[] cols = community.getCollections();
for (int i = 0; i < cols.length; i++)
{
count(cols[i]);
}
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
}
/**
* count and cache the number of items in the given collection
*
* @param collection
* @throws ItemCountException
*/
private void count(Collection collection)
throws ItemCountException
{
try
{
int ccount = collection.countItems();
dao.collectionCount(collection, ccount);
}
catch (SQLException e)
{
log.error("caught exception: ", e);
throw new ItemCountException(e);
}
}
}

View File

@@ -0,0 +1,167 @@
/*
* ItemListConfig.java
*
* Copyright (c) 2002-2007, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
import org.dspace.core.ConfigurationManager;
/**
* Class to mediate with the item list configuration
*
* @author Richard Jones
*
*/
public class ItemListConfig
{
/** a map of column number to metadata value */
private Map metadata = new HashMap();
/** a map of column number to data type */
private Map types = new HashMap();
/** constant for a DATE column */
private static final int DATE = 1;
/** constant for a TEXT column */
private static final int TEXT = 2;
/**
* Create a new instance of the Item list configuration. This loads
* all the required information from configuration
*
* @throws BrowseException
*/
public ItemListConfig()
throws BrowseException
{
try
{
String configLine = ConfigurationManager.getProperty("webui.itemlist.columns");
if (configLine == null || "".equals(configLine))
{
throw new BrowseException("There is no configuration for webui.itemlist.columns");
}
// parse the config
StringTokenizer st = new StringTokenizer(configLine, ",");
int i = 1;
while (st.hasMoreTokens())
{
Integer key = new Integer(i);
String token = st.nextToken();
// find out if the field is a date
if (token.indexOf("(date)") > 0)
{
token = token.replaceAll("\\(date\\)", "");
types.put(key, new Integer(ItemListConfig.DATE));
}
else
{
types.put(key, new Integer(ItemListConfig.TEXT));
}
String[] mdBits = interpretField(token.trim(), null);
metadata.put(key, mdBits);
// don't forget to increment the key counter
i++;
}
}
catch (IOException e)
{
throw new BrowseException(e);
}
}
/**
* how many columns are there?
*
* @return the number of columns
*/
public int numCols()
{
return metadata.size();
}
/**
* what metadata is to go in the given column number
*
* @param col
* @return
*/
public String[] getMetadata(int col)
{
return (String[]) metadata.get(new Integer(col));
}
/**
* Take a string representation of a metadata field, and return it as an array.
* This is just a convenient utility method to basically break the metadata
* representation up by its delimiter (.), and stick it in an array, inserting
* the value of the init parameter when there is no metadata field part.
*
* @param mfield the string representation of the metadata
* @param init the default value of the array elements
* @return a three element array with schema, element and qualifier respectively
*/
public String[] interpretField(String mfield, String init)
throws IOException
{
StringTokenizer sta = new StringTokenizer(mfield, ".");
String[] field = {init, init, init};
int i = 0;
while (sta.hasMoreTokens())
{
field[i++] = sta.nextToken();
}
// error checks to make sure we have at least a schema and qualifier for both
if (field[0] == null || field[1] == null)
{
throw new IOException("at least a schema and element be " +
"specified in configuration. You supplied: " + mfield);
}
return field;
}
}

View File

@@ -0,0 +1,168 @@
/*
* LocaleOrderingFilter.java
*
* Version: $Revision: 1.0 $
*
* Date: $Date: 2007/03/02 11:22:13 $
*
* Copyright (c) 2002-2005, Hewlett-Packard Company and Massachusetts
* Institute of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Hewlett-Packard Company nor the name of the
* Massachusetts Institute of Technology nor the names of their
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.browse;
import java.util.Locale;
import org.apache.log4j.Logger;
import org.dspace.core.ConfigurationManager;
import org.dspace.text.filter.TextFilter;
import com.ibm.icu.text.CollationElementIterator;
import com.ibm.icu.text.Collator;
import com.ibm.icu.text.RuleBasedCollator;
/**
* Makes a sort string that is Locale dependent.
* Uses the same Locale for all items, regardless of source language.
*
* You can set the Locale to use by setting 'webui.browse.sort.locale'
* in the dspace.cfg to an ISO code.
*
* If you do not specify a Locale, then it defaults to Locale.ENGLISH.
*
* IMPORTANT: The strings that this generates are NOT human readable.
* Also, you will not be able to meaningfully apply any filters *after* this,
* however, you can apply other filters before.
*
* @author Graham Triggs
*/
public class LocaleOrderingFilter implements TextFilter
{
private static Logger log = Logger.getLogger(LocaleOrderingFilter.class);
/**
* Uses a Locale dependent Collator to generate a sort string
* @param str The string to parse
* @return String the sort ordering text
*/
public String filter(String str)
{
RuleBasedCollator collator = getCollator();
// Have we got a collator?
if (collator != null)
{
int element;
StringBuffer buf = new StringBuffer();
// Iterate throught the elements of the collator
CollationElementIterator iter = collator.getCollationElementIterator(str);
while ((element = iter.next()) != CollationElementIterator.NULLORDER)
{
// Generate a hexadecimal string representaion of the Collation element
// This can then be compared in a text sort ;-)
String test = Integer.toString(element, 16);
buf.append(test);
}
return buf.toString();
}
return str;
}
/**
* We don't need to use the language parameter, so map this to
* the standard sort string filter
*/
public String filter(String str, String lang)
{
return filter(str);
}
/**
* Get a Locale dependent collator
*
* @return The collator to use
*/
private static RuleBasedCollator getCollator()
{
// Get the Locale to use
Locale locale = getSortLocale();
if (locale != null)
{
// Get collator for the supplied Locale
RuleBasedCollator collator = (RuleBasedCollator)Collator.getInstance(locale);
if (collator != null)
return collator;
}
return null;
}
/**
* Get a Locale to use for the sorting
*
* @return The Locale to use
*/
private static Locale getSortLocale()
{
Locale theLocale = null;
// Get a Locale configuration from the dspace.cfg
String locale = ConfigurationManager.getProperty("webui.browse.sort.locale");
if (locale != null)
{
// Attempt to create Locale for the configured value
String[] localeArr = locale.split("_");
if (localeArr.length > 1)
theLocale = new Locale(localeArr[0], localeArr[1]);
else
theLocale = new Locale(locale);
// Return the configured locale, or English default
if (theLocale == null)
{
log.warn("Could not create the supplied Locale: webui.browse.sort.locale=" + locale);
return Locale.ENGLISH;
}
}
else
return Locale.ENGLISH;
return theLocale;
}
}

Some files were not shown because too many files have changed in this diff Show More