Listeners

Server side plugins take the form of listeners. A listener is configured to listen for specific types of activity on the server. A listener is implemented by writing a class that implements one of the interfaces defined in the "org.actioncenters.core.contribution.svc.notification.listeners" package.

The available listener interfaces are:
IAddContributionListener: Invoked whenever a user adds a contribution.
IAddRelationshipListener: Invoked whenever a new relationship is created between contributions.
IAddUserRoleListener: Invoked whenever a user is assigned to a new role.
IMoveContributionListener: Invoked whenever a contribution is move from one superior relationship to another.
IRemoveContributionListener: Invoked whenever a contribution is removed from the system.
IUpdateContributionListener: Invoked whenever a contribution is updated.
IUpdateContributionThumbprintsListener: Invoked whenever the thumbprint is update on a contribution.
IUserMessageListener: Invoked whenever a message is sent to a user

Implementing a Listener

Write a new java class that implements the desired listener interface and implements all of the defined methods.

Registering a Listener

The listener has to be registered with the ActionCenters system so that it can be notified of the desired events.

To register a listener, find the bean "notificationService" in the actioncenters.xml spring configuration file. Find the appropriate listener property and add your new listener to the list of listeners in that section.

        
	<bean id="notificationService"
		class="org.actioncenters.core.contribution.svc.notification.impl.ContributionNotificationService">
		<property name="addContributionListeners">
			<set>
				<bean
					class="<listener class name>" />
			</set>
		</property>
	</bean>