Dear,
I posted is in the Dspace Developers, but I didn't get any answer, so I
would like to do a custom DSpace listener in DSpace 5.x that it looks like
the Consumer that I did to my blog, "
http://luizclaudiosantos.me/the-most-useless-dspace-consumer-ever/", I did
the code below, the idea is pretty simple, get the event name and put it in
the log.
package com.github.luizclaudiosantos.impl;
import org.apache.log4j.Logger;
import org.dspace.servicemanager.example.EventListenerExample;
import org.dspace.services.model.EventListener;
/**
* Created by Luiz Claudio Santos on 11/25/16.
*/
public class UselessEventListnerSpring implements EventListener {
/** log4j category */
private static Logger log = Logger
.getLogger(EventListenerExample.class);
@Override
public String[] getEventNamePrefixes() {
return new String[0];
}
@Override
public String getResourcePrefix() {
return null;
}
@Override
public void receiveEvent(org.dspace.services.model.Event event) {
log.info("The UselessEventListner get the event: " + event.toString());
}
}
Then I tried get it instanced by Spring:
<?xml version="1.0" encoding="UTF-8"?>
<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"
default-autowire-candidates="*Service,*DAO,javax.sql.DataSource">
<context:annotation-config /> <!-- allows us to use spring annotations in
beans -->
<bean id="org.dspace.example.Example"
class="org.dspace.example.impl.ExampleImpl" />
<bean id="dspace" class="org.dspace.utils.DSpace"/>
<bean id="dspace.eventService"
factory-bean="dspace"
factory-method="getEventService"/>
<bean class="com.github.luizclaudiosantos.impl.UselessEventListnerSpring">
<property name="eventService" >
<ref bean="dspace.eventService"/>
</property>
</bean>
</beans>
Unfortunately, my bean could not get instanced by Spring. The error said
that Spring didn't know the property "eventService". I am trying to do it like
it is in the DSpace documentation
"https://wiki.duraspace.org/display/DSPACE/DSpace+Services+Framework".
My Spring configuration is in the
dspace/modules/additions/src/main/resources/spring/spring-dspace-addon-example-services.xml,
so my question is how can I make eventService available and get my bean
successfully instanced ?
Thanks in advance
Luiz
--
You received this message because you are subscribed to the Google Groups
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.