Versions Compared

Key

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

...

Wiki Markup
The DSpace launcher (\[~mdiggory:dspace\]/bin/dspace) initializes a kernel before dispatching to the selected command.

...

Modular Default Configuration

Wiki Markup
_\[~mdiggory:addon.jar\]/config/\[~mdiggory:service\].cfg _

Any service can provide sane defaults in a java properties configuration file. These properties will be able to be looked up directly using a prefix as syntax.

...

Modularization of Configuration Not Bound to API signature.

Wiki Markup
_\[~mdiggory:dspace\]/config/module/\[~mdiggory:prefix\].cfg_

Any service can provide overrides in the DSpace home configuration directory sane defaults in a java properties configuration file. These properties will be able to be looked up directly using a prefix as syntax.

...

Wiki Markup
Test-driven development is related to the test-first programming concepts of [extreme programming|http://en.wikipedia.org/wiki/Extreme_programming], begun in 1999,\[~mdiggory:[2]\|http://en.wikipedia.org/wiki/Test-driven_development#cite_note-Cworld92-1\] but more recently has created more general interest in its own right.\[~mdiggory:[3]\|http://en.wikipedia.org/wiki/Test-driven_development#cite_note-Newkirk-2\]

...

Wiki Markup
We place the Spring Configuration in a special place for the DSpace Service Manager, and the Service Manager is pretty smart about finding these.  It expects us to place these files in a couple different places.  But in our example I will show the current places in DSpace 1.7.x. In all cases we want to be placing these files under _\[~mdiggory:dspace-module\]/src/main/resources/spring_

...

This location allows us to "augment the existing services without actually overriding them", we generally reserve this for the core dspace services like RequestService, ConfigurationService, SessionService, etc

Wiki Markup
{*}dspace-spring-addon-\[~mdiggory:a unique name\]-service.xml{*}

This location allows us to "override" the XML loading a specific service by overwriting its configuration in one of our own
Now to show you our Launcher Service. The trick here is we will use a feature in Spring called, autowire byType, it will collect all the Commands and wire them together for us, not matter the type. I'll save you having to view the whole file, DSpace Spring Services Tutorial~mdiggory:you can see it here if you like|^dspace-spring-core-services.xml|\.

Code Block
<?xml version="1.0" encoding="UTF-8"?>
<!--

    The contents of this file are subject to the license and copyright
    detailed in the LICENSE and NOTICE files at the root of the source
    tree and available online at

    http://www.dspace.org/license/

-->
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
           http://www.springframework.org/schema/context
           http://www.springframework.org/schema/context/spring-context-2.5.xsd">

    <!-- allows us to use spring annotations in beans -->
    <context:annotation-config/>


    <!-- Instantiate the Launcher Service and Autowire its dependencies -->
    <bean class="org.dspace.app.launcher.ScriptLauncher" autowire="byType"/>

    <bean class="org.dspace.app.launcher.Command">
        <property name="name" value="checker"/>
        <property name="description" value="Run the checksum checker"/>
        <property name="steps">
            <list>
                <bean class="org.dspace.app.launcher.Step">
                    <property name="className" value="org.dspace.app.checker.ChecksumChecker"/>
                </bean>
            </list>
        </property>
    </bean>

...