Running pebble inside Equinox
A casestudy: Running a standard war file inside an OSGi container.
Pebble goes OSGi
Building OSGi ready pebble with maven
Setting up a maven build using OSGi bundles
Building Pebble with maven
Third time it's a charm
Migration from Acegi to Spring Security
Moving from Acegi to Spring-Security
Adding the listener aspect
bundle the listeners
Listeners are configured as properties like this:
#net.sourceforge.pebble.event.response.DeleteRejectedListenerAnd added during creation of the domain object
#net.sourceforge.pebble.event.comment.EmailAuthorNotificationListener
Blog like this
if (!classes[i].startsWith("#")) {
try {
Class c = Class.forName(classes[i].trim());
BlogListener listener = (BlogListener)c.newInstance();
eventListenerList.addBlogListener(listener);
Class.forName will not work in an OSGi environment. Thus requires the Listeners to reside inside the bundle creating them. To use the dynamics of the OSGi runtime Listeners should be deployed in separate bundles.The Listeners are part of the pebble API and the core implementation moved to a separate bundle
<bean id="emailNotificationListener" class="net.sourceforge.pebble.event.blogentry.EmailNotificationListener" autowire="constructor"/>All available implementations are gathered using:
<!-- OSGi service -->
<osgi:service ref="emailNotificationListener" interface="net.sourceforge.pebble.api.event.blogentry.BlogEntryListener" />
<osgi:service interface="net.sourceforge.pebble.api.event.blogentry.BlogEntryListener">
<bean class="net.sourceforge.pebble.event.blogentry.EmailSubscriptionListener" autowire="constructor" />
</osgi:service>
<!-- OSGi service -->
<osgi:service ref="emailNotificationListener" interface="net.sourceforge.pebble.api.event.blogentry.BlogEntryListener" />
<osgi:service interface="net.sourceforge.pebble.api.event.blogentry.BlogEntryListener">
<bean class="net.sourceforge.pebble.event.blogentry.EmailSubscriptionListener" autowire="constructor" />
</osgi:service>
<osgi:set id="blogEntryListenerSet" interface="net.sourceforge.pebble.api.event.blogentry.BlogEntryListener" cardinality="0..N"/>Additionally the
Listeners are now registered by name:
ipAddressListenerIdentified using a name, defaulting to:
linkSpamListener
contentSpamListener
spamScoreListener
markApprovedWhenAuthenticatedListener
@Override
public String getName() {
return getClass().getSimpleName();
}
