Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: link to newer DSpace Services with hibernate
Info
titleThis is not the DSpace 6 Services + Hibernate section

This document refers to 1.6 to DSpace 2.0 code, i.e. dspace-services, this is very old. You are likely looking for the DSpace 6 refactoring that introduces clean business services and the Hibernate refactoring, look at: DSpace Service based api

 

Table of Contents
Excerpt
hiddentrue

DSpace Services Framework is maintained as a Supported Addon Module Dependency for DSpace 1.6 - 2.x .

DSpace Services Framework is maintained as a Supported Addon Module Dependency for DSpace 1.6 - 2.x

...

Event Listeners can be created by overriding the the EventListener interface:

Code Block

<?xml version="1.0" encoding="UTF-8"?>
<beans>

    <bean id="dspace" class="org.dspace.utils.DSpace"/>

    <bean id="dspace.eventService"
          factory-bean="dspace"
          factory-method="getEventService"/>

    <bean class="org.my.EventListener">
         <property name="eventService" >
    		<ref bean="dspace.eventService"/>
    	</property>
    </bean>
</beans>

...

Java Analogy – This Java code will perform the exact same steps as the above Spring configuration.

Code Block

//Initialize DSpace utility/helper object (to interact with the Kernel)
DSpace dspace = new DSpace();

//Get the EventService registered with the DSpace Kernel
EventService eventService = dspace.getEventService();

//Register a new EventListener with the existing EventService
//(Allows you to perform an action in your EventListener whenever an event is fired)
EventListener listener = new org.my.EventListener();
eventService.registerEventListener(listener);

...

The kernel can be started and accessed through the use of Servlet Filter/ContextListeners which are provided as part of the DSpace 2 utilities. Developers don't need to understand what is going on behind the scenes and can simply write their applications and package them as webapps and take advantage of the services which are offered by DSpace 2. Access to the kernel is provided via the Kernel Manager and the DSpace object which will locate the kernel object and allow it to be used. 

Code Block

/* Instantiate the Utility Class */
DSpace dspace = new DSpace();


/* Access get the Service Manager by convenience method */
ServiceManager manager = dspace.getServiceManager();


/* Or access by convenience method for default services */
EventService service = dspace.getEventService();

...