Info | ||
---|---|---|
| ||
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 | ||
---|---|---|
| ||
DSpace Services Framework is maintained as a Supported Addon Module Dependency for DSpace 1.6 - 2.x . |
...
Documentation
- Under development...
DSpace Services Framework - The TAO of DSpace Services
- DSpace Spring Services Tutorial
Other Resources
- Mark Diggory's talk at DSUG09 on Backporting 2.0 Services
- DSpace 2.0 Modelling Services
- DSpace 2.0 Core Services
...
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 canto perform an action in your EventListener whenever an event is fired) EventListener listener = new org.my.EventListener(); eventService.registerEventListener(listener); |
Note: The above is completely valid Java code, assuming you create a new org.my.EventListener
class, or replace it with a different, existing listener.
...
The kernel will automatically register itself as an MBean in when it starts up so that it can be managed. It allows startup and shutdown and provides direct access to the ServiceManager and the ConfigurationService. All the other core services can be retrieved from the ServiceManager by their APIs.
Kernel registration is currently handled in the following ways:
- XMLUI or JSPUI application – Load the
org.dspace.servicemanager.servlet.DSpaceKernelServletContextListener
in their respectiveweb.xml
files. This Listener initializes a new Kernel, which "lives" until the Servlet Context is destroyed. - 'dspace' command-line launcher – The
org.dspace.app.laucher.ScriptLauncher
class initializes a new Kernel to run the command (and destroys it after the command is completed).
Kernel Startup and Access
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();
|
...