...
The excellent presentation
Customizing DSpace 1.5 with Basic Overlays
from Open Repositories O8, by
Tim Donohue and
Graham Triggs shows how to manage your local UI customizations and keep your added code well-segregated from the DSpace codebase so upgrades are simplified.
It also provides an overview of the build process and how maven
overlays work.
Recipe 3: (Deprecated) Old Quick-and-Dirty Method of Adding Plugins
...
With the overlay mechanism,
it is easy to add a Crosswalk
or PackagerPlugins plugin to one of the webapps. This technique
does not let you add code to the libraries accessed by the
command-line utilities, such as dspace/bin/packager
(more
about that later).
The following notes assume a binary installation of DSpace 1.5.0,
under the directories:
Wiki Markup |
---|
*{{\[source\]}}* is the "source" directory where builds are done. |
Wiki Markup |
---|
*{{\[dspace\]}}* is the target runtime directory, e.g. {{/dspace}} |
Procedure to Add a Plugin
Step 1: Install sources
Wiki Markup |
---|
Add the necessary Java source files to the _overlay directory_ for each |
module that you want to have access to the plugin. This |
issource is
{{_\[source\]_/dspace/modules/_\{MODULE\}_/src/main/java |
}} for additional Java sources. |
Note that adding a plugin to multiple modules requires a separate copy of the source files for each module, which might complicate maintenance when you have to update the sources; use symbolic links to work around this if you are familiar with them.
For this example, I'll show an ingestion/dissemination crosswalk Plugin, and a
package ingester Plugin that are both implemented in the following class
files:
Panelcode |
---|
edu/mit/libraries/facade/PIMConstants.java
edu/mit/libraries/facade/PIMCrosswalk.java
edu/mit/libraries/facade/PIMMETSIngester.java
|
Wiki Markup |
---|
For the example, assume these files reside under a _development |
_ directory, _{{\{development\}}}_. |
To add these classes to the LNI module, we install the sources |
undersource under {{_\[source\]_/dspace/modules/lni/src/main/java}} with the following |
Panelcode |
---|
mkdir -p _[source]_/dspace/modules/lni/src/main/java/edu/mit/libraries/facade
cp _\{development\}_/edu/mit/libraries/facade/*.java _[source]_/dspace/modules/lni/src/main/java/edu/mit/libraries/facade
|
Step 2: Update DSpace Configuration
Wiki Markup |
---|
If you maintain the DSpace configuration file in your source directory |
and use the build tools to copy it into the runtime hierarchy, then |
update the source copy of {{dspace.cfg}} now. (In my development |
environment, I just edit the runtime copy in |
dspace {{\[dspace\]/config/dspace.cfg}}.) |
Add entries for the crosswalks, e.g. like the bold line here
(other entries elided for clarity):
Panelcode |
---|
# Crosswalk Plugins:
plugin.named.org.dspace.content.crosswalk.IngestionCrosswalk = \
*edu.mit.libraries.facade.PIMCrosswalk = PIM *
\*
org.dspace.content.crosswalk.PREMISCrosswalk = PREMIS \
...
|
Step 3: Modify the POM to Add Dependencies
Wiki Markup |
---|
If your code has any new external dependencies (i.e. it needs modules |
not already required by DSpace) then you need to add those to the |
POM for the overlay module. In this example, we add the *bold* lines to the |
LNI module's POM at {{_\[source\]_/dspace/modules/lni/pom.xml}} |
Panel |
---|
... ... ** org.openrdf sesame 2.1 ** |
...