Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You must be familiar with installing and configuring DSpace 1.5. It may help to review Building DSpace From Source.

...

The trick is to manage dependencies correctly. Your local project will depend explicitly on the

...

dspace-api

...

project so it can import DSpace API interfaces and classes. Thus, the

...

dspace-api

...

project cannot depend on it. You have to add a dependency on your local project to every POM that generates an executable build product (i.e. the webapps, and the command-line apps). Those projects also depend on

...

dspace-api

...

so the API classes will be available.

...

Here is a live example of how the DSpace 1.5.2 POMs were modified to add a local package named *

...

dash-api

...

*. This project contains several plugin implementations, and it has its own dependencies on some other projects which support that code. All of the classes in

...

dash-api

...

are in packages under the

...

edu.harvard...

...

hierarchy, so they do not conflict with DSpace.

...

Add the following sections to the POM of the

...

dspace

...

project. This ensures the code gets built, and that it will be available to DSpace command-line utilities.

...

The following notes assume a binary installation of DSpace 1.5.0, under the directories:

...

  • *{{\[source\]}}* is the "source" directory where builds are done. Wiki Markup*{
  • {\[dspace\]}}* is the target runtime directory, [dspace] is the target runtime directory, e.g. {{/dspace}}

Procedure to Add a Plugin

Step 1: Install sources

Wiki MarkupAdd the necessary Java source files to the _overlay directory_ for each module that you want to have access to the plugin. This 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.

...

Code Block
  edu/mit/libraries/facade/PIMConstants.java
  edu/mit/libraries/facade/PIMCrosswalk.java
  edu/mit/libraries/facade/PIMMETSIngester.java

...

For the example, assume these files reside under a _development_ directory, _{{\{development\}}}_.
To add these classes to the LNI module, we install the sources under {{_\[source\]_/dspace/modules/lni/src/main/java}} with the following commands:

Code Block
 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 MarkupIf 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\]/config/dspace.cfg}}.)

Add entries for the crosswalks, e.g. like the bold line here (other entries elided for clarity):

...

Step 3: Modify the POM to Add Dependencies

...

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 dependency lines to the LNI module's POM at {{_\[source\]_/dspace/modules/lni/pom.xml}}

Code Block
  
 <project>
   ...
   <dependencies>
     ...
     <dependency>
       <groupId>org.openrdf</groupId>
       <artifactId>sesame</artifactId>
       <version>2.1</version>
     </dependency>
   </dependencies>
 </project>

...

Assuming that succeeds, run Ant to install the build products.
NOTE: This does NOT install the configuration files, because I don't work that way; perhaps someone who does could add an alternate command here?

Code Block
  \{ shut down servlet container such as Tomcat \}
  cd [source]/dspace/target/dspace-1.5.0-build.dir
  ant update
  \{ start up servlet container such as Tomcat \}

Your DSpace instance should now be running with the new plugins in the LNI application.

...

You can also use the overlay mechanism to implement a local change or bug-fix to the DSpace codebase. The process is exactly the same as for adding plugin implementations, only you add the appropriate DSpace class files to the source directory instead. These will take precedence over the distributed code in the classloader.unmigrated-wiki-markup

Again, add the sources under {{_\[source\]_/dspace/modules/_\{MODULE\}_/src/main/java}} , only under the {{org/dspace/...}} hierarchy.

For example, to fix a bug in the org.dspace.app.oai.DSpaceOAICatalog class, you add that file in Step 1 instead of your own source:

Code Block
 mkdir -p [source]/dspace/modules/oai/src/main/java/org/dspace/app/oai
 cp \{development\}/org/dspace/app/oai/DSpaceOAICatalog.java [source]/dspace/modules/oai/src/main/java/org/dspace/app/oai

...

Code Block
  cp /opt/sesame/lib/*.jar _[dspace]_/lib

Note that the build installation ("ant update") process wipes the runtime "lib" directory clean each time, so you'll have to repeat these commands after every new update.