Page History
...
To use the Framework you must begin by instantiating and starting a DSpaceKernel. The kernel will give you references to the ServiceManager and the ConfigurationService. The ServiceManager can be used to get references to other services and to register services which are not part of the core set.
Access to the kernel is provided via the Kernel Manager through the DSpace object, which will locate the kernel object and allow it to be used.
Anchor | ||||
---|---|---|---|---|
|
...
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 core services */
EventService service = dspace.getEventService();
|
The DSpace launcher (
Code Block |
---|
bin/dspace |
) initializes a kernel before dispatching to the selected command.
Application Frameworks (Spring, Guice, etc.)
...
Event Listeners can be created by overriding the the EventListener interface:
In Spring:
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> |
(org.my.EventListener will need to register itself with the EventService, for which it is passed a reference to that service via the eventService property.)
or in Java:
Code Block |
---|
DSpace dspace = new DSpace();
EventService eventService = dspace.getEventService();
EventListener listener = new org.my.EventListener();
eventService.registerEventListener(listener);
|
(This registers the listener externally – the listener code assumes it is registered.)
TODO: examples in Guice
TODO: examples of implementing and registering configurations in Spring and Guice
TBS: how we did X before : how we do it using the Framework